toData method

Result<T> toData({
  1. T? data,
  2. T orElse()?,
  3. DateTime? lastUpdate,
})

Attempts to convert the result to Data.

The provided data will be used, if specified, otherwise the existing data will be used if possible. If no data is present, the orElse callback will be used, if provided, to produce fallback data. In case of a failure to produce data, the value will be set to Error.noData.

Implementation

Result<T> toData({T? data, T Function()? orElse, DateTime? lastUpdate}) {
  return value = value.toData(data: data, orElse: orElse, lastUpdate: lastUpdate);
}