refreshGeneratorDetailsApi function
- BuildContext context,
- int id, {
- bool awaitDeviceListRefresh = false,
Refresh the generator details of the device with the given id using the underlying backend API calls
Implementation
Future<void> refreshGeneratorDetailsApi(
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(refreshCachedDevicesProvider);
if (!awaitDeviceListRefresh) {
unawaited(refreshDevices(context));
}
await Future.wait([
if (awaitDeviceListRefresh) refreshDevices(context),
context.asyncRefresh(deviceDetailsApiFamily(id)),
]);
}