fullRefreshControllerClockTime method

Future<void> fullRefreshControllerClockTime(
  1. BuildContext context,
  2. int deviceId
)

Implementation

Future<void> fullRefreshControllerClockTime(
  BuildContext context,
  int deviceId,
) async {
  int i = 0;
  while (i < 30) {
    await fullRefreshGeneratorDetails(
      context,
      deviceId,
      awaitDeviceListRefresh: false,
    );
    if (context.mounted) {
      final generatorDetails = context.read(generatorDetailsFamily(deviceId));
      final generatorClockTime =
          generatorDetails.valueOrNull?.controllerClockTime;
      if (generatorClockTime != null &&
          generatorClockTime.difference(controllerClockTime).abs() <
              const Duration(minutes: 2)) {
        break;
      }
    }
    i++;
  }
}