flutter_secure_dotenv_generator 2.0.1 copy "flutter_secure_dotenv_generator: ^2.0.1" to clipboard
flutter_secure_dotenv_generator: ^2.0.1 copied to clipboard

A development dependency to generate secure dotenv file for flutter_secure_dotenv package.

example/flutter_secure_dotenv_generator_example.dart

import 'package:flutter_secure_dotenv/flutter_secure_dotenv.dart';

part 'env.g.dart';

/// Example using the "Hardcoded Key + Gitignore" pattern.
///
/// This file (env.dart) is GITIGNORED. A template `env.example.dart` with
/// placeholder values is committed instead. See SECURITY.md in
/// flutter_secure_dotenv for details.

@DotEnvGen(filename: '.env', fieldRename: FieldRename.screamingSnake)
abstract class Env {
  // These values come from the temporary encryption_key.json generated by
  // build_runner. Copy them here, then delete the JSON file.
  static const _encryptionKey = 'YOUR_BASE64_ENCRYPTION_KEY';
  static const _iv = 'YOUR_BASE64_IV';

  static Env create() => Env(_encryptionKey, _iv);

  const factory Env(String encryptionKey, String iv) = _$Env;

  const Env._();

  @FieldKey(defaultValue: '')
  String get apiBaseUrl;

  @FieldKey(defaultValue: '')
  String get apiWebSocketUrl;
}
4
likes
160
points
2.5k
downloads

Publisher

verified publishermfazrinizar.com

Weekly Downloads

A development dependency to generate secure dotenv file for flutter_secure_dotenv package.

Repository (GitHub)
View/report issues
Contributing

Documentation

API reference

License

MIT (license)

Dependencies

analyzer, build, collection, dotenv, flutter_secure_dotenv, logging, pointycastle, source_gen, source_helper

More

Packages that depend on flutter_secure_dotenv_generator