Added env files and the read base url using the dotenv package

This commit is contained in:
Abdullah Alassaf
2024-07-21 11:45:49 +03:00
parent 980d1017eb
commit 79a1c69af1
10 changed files with 100 additions and 84 deletions

View File

@ -2,6 +2,7 @@ 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.dart';
import 'package:syncrow_app/services/locator.dart';
import 'package:syncrow_app/utils/bloc_observer.dart';
@ -15,9 +16,8 @@ void main() {
//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: 'production');
await dotenv.load(fileName: '.env.$environment');
// //this is to make the app work with the self-signed certificate
// HttpOverrides.global = MyHttpOverrides();