import 'dart:collection'; import 'package:comunic/models/post.dart'; /// Posts List /// /// Contains method to easily process a list of posts /// /// @author Pierre HUBERT class PostsList extends ListBase { List _list = List(); int get length => _list.length; set length(int l) => _list.length = l; @override Post operator [](int index) => _list[index]; @override void operator []=(int index, Post value) => _list[index] = value; // Get the list of users ID in this set Set get usersID { Set set = Set(); forEach((p) { set.add(p.userID); if(p.userPageID != null && p.userPageID > 0) set.add(p.userPageID); }); return set; } }