watch method Null safety

Future<void> watch(
  1. List<Cubix> cubixes
)

watch changes of cubixes, unlikely cubix.watch(), this method returns a future object that is completed when given cubixes are changed

Implementation

Future<void> watch(List<Cubix> cubixes) {
  final completer = Completer<void>();
  VoidCallback? removeWatcher;
  removeWatcher = _getResolveContext().watch(cubixes, (_) {
    removeWatcher?.call();
    if (cancelled) return;
    completer.complete(null);
  });
  return completer.future;
}