env_serde.dart 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. import 'package:json_annotation/json_annotation.dart';
  2. // Run `dart run build_runner build` to generate the json serialization If the
  3. // file `env_serde.i.dart` is existed, delete it first.
  4. //
  5. // the file `env_serde.g.dart` will be generated in the same directory. Rename
  6. // the file to `env_serde.i.dart` because the file is ignored by default.
  7. part 'env_serde.i.dart';
  8. @JsonSerializable()
  9. class AppFlowyEnv {
  10. final SupabaseConfiguration supabase_config;
  11. AppFlowyEnv({
  12. required this.supabase_config,
  13. });
  14. factory AppFlowyEnv.fromJson(Map<String, dynamic> json) =>
  15. _$AppFlowyEnvFromJson(json);
  16. Map<String, dynamic> toJson() => _$AppFlowyEnvToJson(this);
  17. }
  18. @JsonSerializable()
  19. class SupabaseConfiguration {
  20. /// Indicates whether the sync feature is enabled.
  21. final bool enable_sync;
  22. final String url;
  23. final String anon_key;
  24. final String jwt_secret;
  25. SupabaseConfiguration({
  26. this.enable_sync = true,
  27. required this.url,
  28. required this.anon_key,
  29. required this.jwt_secret,
  30. });
  31. factory SupabaseConfiguration.fromJson(Map<String, dynamic> json) =>
  32. _$SupabaseConfigurationFromJson(json);
  33. Map<String, dynamic> toJson() => _$SupabaseConfigurationToJson(this);
  34. }