Files
2026-04-11 00:05:06 +02:00

49 lines
1.2 KiB
Dart

// ignore_for_file: public_member_api_docs, sort_constructors_first
import 'dart:convert';
class UserModel {
final String uuid;
final String username;
final String passwort;
UserModel({
required this.uuid,
required this.username,
required this.passwort,
});
UserModel copyWith({
String? uuid,
String? username,
String? passwort,
}) {
return UserModel(
uuid: uuid ?? this.uuid,
username: username ?? this.username,
passwort: passwort ?? this.passwort,
);
}
Map<String, dynamic> toMap() {
return <String, dynamic>{
'pk_userUuid': uuid,
'benutzer': username,
'kennwort': passwort,
};
}
factory UserModel.fromMap(Map<String, dynamic> map) {
return UserModel(
uuid: (map['pk_userUuid'] as String).trim(),
username: (map['benutzer'] as String).trim(),
passwort: (map['kennwort'] as String).trim(),
);
}
String toJson() => json.encode(toMap());
factory UserModel.fromJson(String source) => UserModel.fromMap(json.decode(source) as Map<String, dynamic>);
@override
String toString() => 'UserModel(uuid: $uuid, username: $username, passwort: $passwort)';
}