Skip to content

Latest commit

 

History

History
69 lines (46 loc) · 2.17 KB

File metadata and controls

69 lines (46 loc) · 2.17 KB

int.fromEnvironment and bool.fromEnvironment

Did you know?

In addition to String.fromEnvironment, Dart also supports:

Very handy when reading environment variables from your .env files:


class Env {
  static int get appStoreId => const
      int.fromEnvironment('APP_STORE_ID'); // defaults to 0
  static bool get collectAnalytics => const
      bool.fromEnvironment('COLLECT_ANALYTICS'); // defaults to false
  static String get sentryDsn => const
      String.fromEnvironment('SENTRY_DSN'); // defaults to ""
}

To learn more about environment variables and best practices for storing API keys, read:


Previous Next
Hot Reload on Flutter web (beta) Release Toggles with Dart Defines