KaeruStreamBuilder<T> extension
Extension for concise StreamBuilder usage with customizable states.
This extension allows you to easily attach UI logic for different stream states:
- success: when new data is emitted
- error: when an error occurs
- loading: while waiting for the first value
- noData: when the stream completes without emitting data
Example:
myStream.streamBuilder(
success: (ctx, data) => Text('Data: $data'),
error: (ctx, err) => Text('Error: $err'),
loading: (ctx) => const CircularProgressIndicator(),
noData: (ctx) => const Text('No data available'),
);
- on
-
- Stream<
T>
- Stream<
Methods
-
streamBuilder(
{required Widget success(BuildContext, T data), Widget error(BuildContext, Object? error)?, Widget loading(BuildContext)?, Widget noData(BuildContext)?}) → Widget -
Available on Stream<
Builds aT> , provided by the KaeruStreamBuilder extensionStreamBuilderwith shorthand callbacks for common states.