Skip to content

Instantly share code, notes, and snippets.

@rafa-js
rafa-js / stream_widget.dart
Last active February 13, 2020 08:30
[Flutter] Reusable Widget to handle the common flows working with Streams
import 'package:flutter/material.dart';
class StreamWidget<T> extends StatelessWidget {
final Stream<T> stream;
final Widget Function() onLoading;
final Widget Function(T) onData;
final Widget Function(dynamic) onError;
const StreamWidget({
@required this.stream,