Skip to content

Commit

Permalink
refactor: facelift both Envied and EnviedGenerator to Dart 3.0 (#46)
Browse files Browse the repository at this point in the history
* ⬆️ update dependencies

* ⚡ make Envied and EnviedField final

* ⚡ add Dart 3 class modifiers to generator

* ♻️ refactor generator

* ♻️ refactor generator

* 🧑‍💻 fix/upgrade example

* 🧑‍💻 fix/upgrade example
  • Loading branch information
techouse authored Aug 22, 2023
1 parent 02edfb5 commit 0952c18
Show file tree
Hide file tree
Showing 24 changed files with 321 additions and 313 deletions.
7 changes: 5 additions & 2 deletions examples/envied_example/.env
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
KEY1=VALUE1
KEY2=VALUE2
KEY1=foo
KEY2=bar
key3=baz
key4=123
key5=false
7 changes: 5 additions & 2 deletions examples/envied_example/.env_debug
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
KEY1=DEBUG1
KEY2=DEBUG2
KEY1=debug_foo
KEY2=debug_bar
key3=debug_baz
key4=456
key5=true
2 changes: 1 addition & 1 deletion examples/envied_example/lib/app_env.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import 'app_env_fields.dart';
import 'debug_env.dart';
import 'release_env.dart';

abstract class AppEnv implements AppEnvFields {
abstract interface class AppEnv implements AppEnvFields {
/// NOTE: This is here just as an example!
///
/// In a Flutter app you would normally import this like so
Expand Down
2 changes: 1 addition & 1 deletion examples/envied_example/lib/app_env_fields.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/// Both DebugEnv and ReleaseEnv must implement all these values
abstract class AppEnvFields {
abstract interface class AppEnvFields {
abstract final String key1;
abstract final String key2;
abstract final String key3;
Expand Down
2 changes: 1 addition & 1 deletion examples/envied_example/lib/debug_env.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import 'app_env_fields.dart';
part 'debug_env.g.dart';

@Envied(name: 'Env', path: '.env_debug')
class DebugEnv implements AppEnv, AppEnvFields {
final class DebugEnv implements AppEnv, AppEnvFields {
const DebugEnv();

@override
Expand Down
10 changes: 5 additions & 5 deletions examples/envied_example/lib/debug_env.g.dart

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

6 changes: 3 additions & 3 deletions examples/envied_example/lib/env.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ import 'package:envied/envied.dart';
part 'env.g.dart';

@Envied(path: '.env')
abstract class Env {
final class Env {
@EnviedField(varName: 'KEY1')
static const key1 = _Env.key1;
static const String key1 = _Env.key1;
@EnviedField(varName: 'KEY2')
static const key2 = _Env.key2;
static const String key2 = _Env.key2;
@EnviedField()
static const String key3 = _Env.key3;
@EnviedField()
Expand Down
12 changes: 6 additions & 6 deletions examples/envied_example/lib/env.g.dart

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

2 changes: 1 addition & 1 deletion examples/envied_example/lib/release_env.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import 'app_env_fields.dart';
part 'release_env.g.dart';

@Envied(name: 'Env', path: '.env')
class ReleaseEnv implements AppEnv, AppEnvFields {
final class ReleaseEnv implements AppEnv, AppEnvFields {
const ReleaseEnv();

@override
Expand Down
12 changes: 6 additions & 6 deletions examples/envied_example/lib/release_env.g.dart

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

Loading

0 comments on commit 0952c18

Please sign in to comment.