onInit method

  1. @override
void onInit()
override

Called immediately after the widget is allocated in memory. You might use this to initialize something for the controller.

Implementation

@override
void onInit() {
  _profilesSubscription = _myUserProvider.watch().listen((ops) {
    for (var e in ops) {
      switch (e.op) {
        case OperationKind.added:
        case OperationKind.updated:
          profiles.addIf(
            profiles.none((m) => m.id.val == e.key?.val),
            e.value!.value,
          );
          break;

        case OperationKind.removed:
          profiles.removeWhere((m) => m.id.val == e.key?.val);
          break;
      }
    }
  });

  super.onInit();
}