import 'package:flutter/widgets.dart'; sealed class AuthenticationState { const AuthenticationState(); bool authenticated(); } class Unauthenticated extends AuthenticationState { @override bool authenticated() { return false; } } class Authenticated extends AuthenticationState { final String token; final String username; const Authenticated(this.token, this.username); @override bool authenticated() { return true; } } class AuthenticationModel extends ChangeNotifier { AuthenticationState _state = Unauthenticated(); AuthenticationState get state => _state; set state(AuthenticationState newState) { _state = newState; notifyListeners(); } } String? usernameValidator(String? value) { if (value == null || value.trim().length < 3) { return 'Please enter a valid username.'; } return null; } String? passwordValidator(String? value) { if (value == null || value.length < 8) { return 'Please enter a valid password.'; } return null; }