21 lines
712 B
Dart
21 lines
712 B
Dart
import 'package:freezed_annotation/freezed_annotation.dart';
|
|
import '../../domain/entities/server_config.dart';
|
|
|
|
part 'settings_state.freezed.dart';
|
|
|
|
enum ConnectionStatus { unknown, checking, connected, error }
|
|
|
|
@freezed
|
|
class SettingsState with _$SettingsState {
|
|
const factory SettingsState.initial() = SettingsInitial;
|
|
const factory SettingsState.loading() = SettingsLoading;
|
|
const factory SettingsState.loaded({
|
|
required String apiUrl,
|
|
required ServerConfig? serverConfig,
|
|
required String languageCode,
|
|
String? error,
|
|
@Default(ConnectionStatus.unknown) ConnectionStatus connectionStatus,
|
|
}) = SettingsLoaded;
|
|
const factory SettingsState.error(String message) = SettingsError;
|
|
}
|