mirror of
https://gitlab.com/comunic/comunicmobile
synced 2024-11-22 21:09:21 +00:00
34 lines
773 B
Dart
34 lines
773 B
Dart
import 'dart:collection';
|
|
|
|
import 'package:comunic/lists/users_list.dart';
|
|
import 'package:comunic/models/conversation.dart';
|
|
|
|
/// Conversations list
|
|
///
|
|
/// @author Pierre HUBERT
|
|
|
|
class ConversationsList extends ListBase<Conversation> {
|
|
|
|
final List<Conversation> _list = List();
|
|
UsersList users;
|
|
|
|
set length(l) => _list.length = l;
|
|
int get length => _list.length;
|
|
|
|
@override
|
|
Conversation operator [](int index) => _list[index];
|
|
|
|
@override
|
|
void operator []=(int index, Conversation value) => _list[index] = value;
|
|
|
|
/// Get the entire lists of users ID in this list
|
|
List<int> get allUsersID {
|
|
final List<int> list = List();
|
|
forEach((c) => c.members.forEach((id){
|
|
if(!list.contains(id))
|
|
list.add(id);
|
|
}));
|
|
return list;
|
|
}
|
|
}
|