flutter_secure_dotenv_generator 2.0.1
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;
}