1
0
mirror of https://gitlab.com/comunic/comunicmobile synced 2025-06-19 00:05:16 +00:00

Get latest posts from server

This commit is contained in:
2019-05-10 19:15:11 +02:00
parent 8d188373ce
commit ddbea1727b
9 changed files with 301 additions and 3 deletions

39
lib/lists/posts_list.dart Normal file
View File

@ -0,0 +1,39 @@
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<Post> {
List<Post> _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<int> get usersID {
Set<int> set = Set();
forEach((p) {
set.add(p.userID);
if(p.userPageID != null && p.userPageID > 0)
set.add(p.userPageID);
});
return set;
}
}