getData method

  1. @override
Future<void> getData(
  1. bool insert, {
  2. String? term,
})
override

Implementation

@override
Future<void> getData(bool insert, {String? term}) async {
  try {
    // This getData method called when user push bell widget at bottom.
    if (!read) {
      await plugin.updateSeen(holder.seenAt!);
    }
    await count;
    Tuple2 res = await plugin.listNotifications(
        limit: 25, seenAt: holder.seenAt, cursor: holder.cursor);
    holder.makeNotifications(insert, ListNotifications(res.item2));
    if (holder.uris.isEmpty) {
      return;
    }
    Tuple2 res2 = await plugin.getPosts(holder.uris);
    holder.makePosts(res2.item2["posts"]);
  } catch (e, stacktrace) {
    // TODO
    debugPrint("Error: $e");
    debugPrint("stacktrace: $stacktrace");
  }
}