Flutter. Using environment variables.

Step 1

flutter_dotenv: ^2.1.0

Step 2

import 'package:flutter_dotenv/flutter_dotenv.dart';

Step 3

void main() => runApp(MyApp());
Future main() async {
await DotEnv().load('.env');
runApp(MyApp());
}

Step 4

import 'package:flutter_dotenv/flutter_dotenv.dart';// some classprint(DotEnv().env['VAR_NAME'])

Java, Spring, Node.js, AdonisJs, React.js and Flutter developer

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store