Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: multiple generations for same class #123

Closed
wants to merge 8 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions examples/envied_example/.gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Files and directories created by pub.
.dart_tool/
.packages
.pubspec.lock

# Conventional directory for build output.
build/
66 changes: 66 additions & 0 deletions examples/envied_example/lib/envs.env.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
// lib/env.dart
import 'package:envied/envied.dart';
import 'package:example/example_enum.dart';

import 'app_env_fields.dart';

part 'envs.env.g.dart';

@Envied(
path: '.env_debug',
name: 'Dev',
allowOptionalFields: true,
interpolate: false,
obfuscate: false,
requireEnvFile: true,
rawStrings: true,
useConstantCase: false,
randomSeed: 1)
@Envied(path: '.env', name: 'Prod')
final class Envs implements AppEnvFields {
/// NOTE: This is here just as an example!
///
/// In a Flutter app you would normally import this like so
/// import 'package:flutter/foundation.dart';
static const kDebugMode = true;

factory Envs() => _instance;

static dynamic _instance = kDebugMode ? _Dev() : _Prod();

@override
@EnviedField(varName: 'KEY1')
final String key1 = _instance.key1;

@override
@EnviedField(varName: 'KEY2')
final String key2 = _instance.key2;

@override
@EnviedField()
final String key3 = _instance.key3;

@override
@EnviedField()
final int key4 = _instance.key4;

@override
@EnviedField()
final bool key5 = _instance.key5;

@override
@EnviedField()
final Uri key6 = _instance.key6;

@override
@EnviedField()
final DateTime key7 = _instance.key7;

@override
@EnviedField()
final ExampleEnum key8 = _instance.key8;

@override
@EnviedField(rawString: true)
final String key9 = _instance.key9;
}
49 changes: 49 additions & 0 deletions examples/envied_example/lib/envs.env.g.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading