fetchData method

Future<void> fetchData({
  1. GetDeviceDetailsMethod getDetails = sdk.DevicesRepository.getDeviceDetails,
})

Implementation

Future<void> fetchData(
    {GetDeviceDetailsMethod getDetails =
        sdk.DevicesRepository.getDeviceDetails}) async {
  setState = WidgetState.loading;

  try {
    _deviceDetail = await getDetails(_request, _deviceId);
    setState = WidgetState.idle;
  } catch (error) {
    setErrorState(error.toString());
  }
}