getDataOrThrow<T> method
T
getDataOrThrow<T>()
Returns the data if successful, otherwise throws an exception
Implementation
T getDataOrThrow<T>() {
if (!success) {
throw Exception(error ?? 'Unknown error occurred');
}
return data as T;
}