env_serde.dart 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  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. SupabaseConfiguration({
  25. this.enable_sync = true,
  26. required this.url,
  27. required this.anon_key,
  28. });
  29. factory SupabaseConfiguration.fromJson(Map<String, dynamic> json) =>
  30. _$SupabaseConfigurationFromJson(json);
  31. Map<String, dynamic> toJson() => _$SupabaseConfigurationToJson(this);
  32. }