fullRefreshGeneratorDetailsApi function

Future<void> fullRefreshGeneratorDetailsApi(
  1. BuildContext context,
  2. int id, {
  3. bool awaitDeviceListRefresh = false,
})

Fully refresh the generator details of the device with the given id using the underlying backend API calls

Implementation

Future<void> fullRefreshGeneratorDetailsApi(
  BuildContext context,
  int id, {
  bool awaitDeviceListRefresh = false,
}) async {
  // Refreshing all devices since part of generator details includes data
  // from this list. Do it in the background because this is typically slow.
  final refreshDevices = context.read(fullRefreshCachedDevicesProvider);

  if (!awaitDeviceListRefresh) {
    unawaited(refreshDevices(context));
  }

  await Future.wait([
    if (awaitDeviceListRefresh) refreshDevices(context),
    context.fullRefresh(deviceDetailsApiFamily(id)),
  ]);
}