requireData property

T requireData

Returns latest data received, failing if there is no data.

Throws error, if hasError. Throws StateError, if neither hasData nor hasError.

Implementation

T get requireData {
  if (hasData)
    return data;
  if (hasError)
    throw error;
  throw StateError('Snapshot has neither data nor error');
}