Streamit TV - Documentation

Flutter Configuration

Estimated reading: 3 minutes

Setting up Flutter for your Streamit TV Project

Change The App’s Name

In the main directory go to the ‘lib → configs.dart’

const APP_NAME = 'YOUR APP NAME';

Reconfiguration The Server URL

In the main directory go to the ‘lib → configs.dart’

Note : Do not add (‘/’) at the end of DOMAIN_URL

const DOMAIN_URL = "ADD YOUR BASE URL" ;

Change Primary Color

In the main directory go to the ‘lib → utils → colors.dart’


const primaryColor = Color(0xFF5F60B9);

const appSecondaryColor = Color(0xFF68685);

Change App Logo

In the main directory go to ‘assets’

  1. Change Logo on splash.screen.dart
    • Replace “app_logo” image with same name just replace file.
  2. Change Logo on home.screen.dart
    • Replace “ic_icon” icon with same name just replace file.

After completing Firebase configuration. Please make sure you update Firebase Options

Update Firebase Option

In the main directory go to the ‘lib → firebase_options.dart’

  ///Note : Values available android/app/google-services.json
static const FirebaseOptions android = FirebaseOptions(
apiKey: 'FIREBASE WEB API KEY',
appId: 'FIREBASE ANDROID APP KEY',
messagingSenderId: 'FIREBASE SENDER ID',
projectId: 'FIREBASE PROJECT ID',
storageBucket: 'FIREBASE STORAGE BUCKET',
);
  • Open your Firebase Console

For apiKey go to Project Settings and click on General Tab you’ll find Web API Key and Project ID and paste it all blocks in dart file mentioned above.

Scroll Down and in Your Apps section you’ll find App Id in Android section. Copy respective values and paste it to appId.

For messagingSenderId Click on Cloud Messaging you will see Sender ID. Copy that paste it to messagingSenderId.

For storageBucket

  • Navigate to android → app
  • Open google-service.json
  • Under “project_info” find “storage_bucket” and Copy value and paste it into storageBucket.Note – You can leave it empty as well.

Note – You can leave it empty as well.

Verify Default Firebase options in Firebase Initialization

  • Open main.dart
  • You will find Firebase.initializeApp in void main() and firebaseMessagingBackgroundHandler() method.
  • verify that Default Firebase Options for current platform is initialized or not.
  await Firebase.initializeApp(options: DefaultFirebaseOptions.currentPlatform).then((value) {
PushNotificationService().initFirebaseMessaging();
if (kReleaseMode) FlutterError.onError = FirebaseCrashlytics.instance.recordFlutterFatalError;
}).catchError(onError);
Future<void> firebaseMessagingBackgroundHandler(RemoteMessage message) async {
await Firebase.initializeApp(options: DefaultFirebaseOptions.currentPlatform);
}

Update Notification Icon Name

After creating notification icon you can perform this change.

  • Open lib → utils → push_notification_service.dart.
  • In initializePlatformSpecificNotificationChannel() method find lines below
  const AndroidInitializationSettings initializationSettingsAndroid = AndroidInitializationSettings('@drawable/YOUR NOTIFICATION ICON NAME');
  • In showNotification() method find lines below
var androidPlatformChannelSpecifics = AndroidNotificationDetails(
...
...
icon: '@drawable/YOUR NOTIFICATION ICON NAME',
);

Set up AdMob

  • Replace Google AdMob IDs for different types of ads in lib -> config.dart
///Android
const String interstitialAdId = 'YOUR_INTERSTITIAL_AD_ID';
const String bannerAdId = 'YOUR_BANNER_AD_ID';

If you haven’t set up AdMob yet, follow these steps:

  1. Set up your app in your AdMob account
    • Register your app as an AdMob app by completing the following steps:
    • Sign in to or sign up for an AdMob account.
    • This step creates an AdMob app with a unique AdMob App ID that is needed later in this guide.
  2. Return to your Application source code.
  3. Open the lib → configs.dart file.
  4. To ensure proper functionality , replace the variables – Keys to replace:
   ///Android
const String interstitialAdId
const String bannerAdId

Change the Google AdMob App ID in AndroidManifest.xml and Info.plist