39 lines
939 B
Dart
39 lines
939 B
Dart
|
|
import 'package:flutter/foundation.dart';
|
||
|
|
|
||
|
|
@immutable
|
||
|
|
class LoginState {
|
||
|
|
const LoginState({
|
||
|
|
this.username = '',
|
||
|
|
this.password = '',
|
||
|
|
this.obscurePassword = true,
|
||
|
|
this.isSubmitting = false,
|
||
|
|
this.errorMessage,
|
||
|
|
});
|
||
|
|
|
||
|
|
final String username;
|
||
|
|
final String password;
|
||
|
|
final bool obscurePassword;
|
||
|
|
final bool isSubmitting;
|
||
|
|
final String? errorMessage;
|
||
|
|
|
||
|
|
static const _sentinel = Object();
|
||
|
|
|
||
|
|
LoginState copyWith({
|
||
|
|
String? username,
|
||
|
|
String? password,
|
||
|
|
bool? obscurePassword,
|
||
|
|
bool? isSubmitting,
|
||
|
|
Object? errorMessage = _sentinel,
|
||
|
|
}) {
|
||
|
|
return LoginState(
|
||
|
|
username: username ?? this.username,
|
||
|
|
password: password ?? this.password,
|
||
|
|
obscurePassword: obscurePassword ?? this.obscurePassword,
|
||
|
|
isSubmitting: isSubmitting ?? this.isSubmitting,
|
||
|
|
errorMessage: identical(errorMessage, _sentinel)
|
||
|
|
? this.errorMessage
|
||
|
|
: errorMessage as String?,
|
||
|
|
);
|
||
|
|
}
|
||
|
|
}
|