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() {
  super.onInit();
  final firstTeamName = initialTeams?.isNotEmpty == true
      ? initialTeams!.first.name
      : '';
  dialogLevel = _DialogLevel(
    type: _DialogLevelType.teammateList,
    teamName: firstTeamName,
  ).obs;

  _loadTeammateStatuses();

  // Periodically refresh to pick up mode changes from teammates.
  // Port of useInterval(() => setRefreshKey(...), 1000)
  _refreshTimer = Timer.periodic(const Duration(seconds: 1), (_) {
    refreshKey.value++;
    _loadTeammateStatuses();
  });
}