Added flavers env and prod for android and ios including Google services

This commit is contained in:
Abdullah Alassaf
2024-09-21 17:17:54 +03:00
parent e23210777a
commit 7279215cdc
26 changed files with 873 additions and 254 deletions

View File

@ -3,19 +3,20 @@ 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.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';
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: 'production');
await dotenv.load(fileName: '.env.$environment');
// 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();
@ -29,11 +30,10 @@ void main() {
// });
//to initialize the locator
initialSetup();
initialSetup(envName: 'prod');
await Firebase.initializeApp(
name: 'test2',
options: DefaultFirebaseOptions.currentPlatform,
options: DefaultFirebaseOptionsStaging.currentPlatform,
);
//final SharedPreferences prefs = await SharedPreferences.getInstance();