mirror of
https://github.com/SyncrowIOT/syncrow-app.git
synced 2025-07-16 01:56:19 +00:00
Added flavers env and prod for android and ios including Google services
This commit is contained in:
49
lib/main_dev.dart
Normal file
49
lib/main_dev.dart
Normal file
@ -0,0 +1,49 @@
|
||||
import 'dart:async';
|
||||
import 'package:firebase_core/firebase_core.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:flutter_dotenv/flutter_dotenv.dart';
|
||||
import 'package:syncrow_app/firebase_options_dev.dart';
|
||||
import 'package:syncrow_app/services/locator.dart';
|
||||
import 'package:syncrow_app/utils/bloc_observer.dart';
|
||||
import 'package:syncrow_app/utils/helpers/localization_helpers.dart';
|
||||
import 'my_app.dart';
|
||||
|
||||
void main() {
|
||||
//to observe the state of the blocs in the output console
|
||||
Bloc.observer = MyBlocObserver();
|
||||
//to catch all the errors in the app and send them to firebase
|
||||
runZonedGuarded(() async {
|
||||
//to load the environment variables
|
||||
// const environment = String.fromEnvironment('FLAVOR', defaultValue: 'prod');
|
||||
await dotenv.load(fileName: '.env.dev');
|
||||
|
||||
// //this is to make the app work with the self-signed certificate
|
||||
// HttpOverrides.global = MyHttpOverrides();
|
||||
WidgetsFlutterBinding.ensureInitialized();
|
||||
|
||||
//license for the font
|
||||
// LicenseRegistry.addLicense(() async* {
|
||||
// final license =
|
||||
// await rootBundle.loadString('assets/fonts/roboto/LICENSE.txt');
|
||||
// yield LicenseEntryWithLineBreaks(['google_fonts'], license);
|
||||
// });
|
||||
|
||||
//to initialize the locator
|
||||
initialSetup(envName: 'dev');
|
||||
|
||||
await Firebase.initializeApp(
|
||||
options: DefaultFirebaseOptionsDev.currentPlatform,
|
||||
);
|
||||
|
||||
//final SharedPreferences prefs = await SharedPreferences.getInstance();
|
||||
|
||||
//to save the locale in the shared preferences
|
||||
await LocalizationService.saveLocale(const Locale("en", "AE"));
|
||||
final savedLocale = await LocalizationService.savedLocale();
|
||||
|
||||
runApp(MyApp(savedLocale));
|
||||
}, (error, stackTrace) {
|
||||
// FirebaseCrashlytics.instance.recordError(error, stackTrace, fatal: true);
|
||||
});
|
||||
}
|
Reference in New Issue
Block a user