class LoginModel { final String username; final String password; // 使用 const 构造函数,并要求所有字段在创建时必须被提供 const LoginModel({required this.username, required this.password}); // (可选)提供一个 toMap 方法,方便将对象转换为 JSON 或 Map Map toMap() { return {'username': username, 'password': password}; } }