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() {
  _callsSubscription = _callService.calls.changes.listen((e) {
    switch (e.op) {
      case OperationKind.removed:
        if (call.value.chatId.value == e.key) {
          pop?.call();
        }
        break;

      case OperationKind.added:
      case OperationKind.updated:
        // No-op.
        break;
    }
  });

  _displaysSubscription = call.value.displays.listen((e) {
    for (MediaDisplayDetails display in e) {
      if (renderers[display] == null) {
        initRenderer(display);
      }
    }
  });

  for (var e in call.value.displays) {
    initRenderer(e);
  }

  selected.value = call.value.displays.firstOrNull;

  super.onInit();
}