Instance of 'NotInitializedError' in Flutter integration
import 'package:flutter/material.dart'; import 'package:flutter_dotenv/flutter_dotenv.dart'; import 'package:profitolio_mobile/config/app_theme.dart'; import 'package:profitolio_mobile/screens/login/login_screen.dart';
void main() async { WidgetsFlutterBinding.ensureInitialized();
await dotenv.load( fileName: '.env');
runApp(MyApp()); }
class MyApp extends StatelessWidget { @override Widget build(BuildContext context) { return MaterialApp( debugShowCheckedModeBanner: false, title: 'Flutter Login', theme: AppTheme.lightTheme, home: LoginScreen(), ); } }
I am getting this error. It would be helpful if someone could come up with a solution. :) ╞═══════════════════════════════════════════════════════════ js_primitives.dart:28 The following NotInitializedError was thrown building Builder: js_primitives.dart:28 Instance of 'NotInitializedError'
First you need to load the .env file after that you can fatch the value