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_prod.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'; const String buildNumber = '1.0.30+17'; 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.prod'); // //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(); await Firebase.initializeApp( options: DefaultFirebaseOptionsStaging.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); }); }