1
0
mirror of https://gitlab.com/comunic/comunicmobile synced 2024-11-29 08:16:28 +00:00
comunicmobile/lib/helpers/serialization/user_list_serialization_helper.dart

29 lines
725 B
Dart

import 'package:comunic/helpers/serialization/base_serialization_helper.dart';
import 'package:comunic/models/user.dart';
/// User serialization helper
///
/// @author Pierre Hubert
UsersListSerialisationHelper _singleton;
class UsersListSerialisationHelper extends BaseSerializationHelper<User> {
UsersListSerialisationHelper._();
factory UsersListSerialisationHelper() {
if (_singleton == null) _singleton = UsersListSerialisationHelper._();
return _singleton;
}
@override
String get type => "users-list";
@override
User parse(Map<String, dynamic> m) => User.fromJson(m);
/// Remove a user by its ID
Future<void> removeUserByID(int userID) =>
removeElement((t) => t.id == userID);
}