Skip to content

Instantly share code, notes, and snippets.

@jmewes
Last active September 18, 2021 17:28
Show Gist options
  • Save jmewes/8eceecd6b46ab9cd03444da495fbceba to your computer and use it in GitHub Desktop.
Save jmewes/8eceecd6b46ab9cd03444da495fbceba to your computer and use it in GitHub Desktop.
How to use assets in Flutter

How to use assets in Flutter

(a)

pubspec.yaml

flutter:

  assets:
  - assets/.env

Usage

Future main() async {

  await dotenv.load(fileName: "assets/.env");

  runApp(const MyApp());
}

(b)

pubspec.yaml

flutter:

  assets:
    - .env

Usage

Future main() async {

  await dotenv.load(fileName: ".env");

  runApp(const MyApp());
}

References

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment