stream_summary_builder 0.1.0-dev.5 copy "stream_summary_builder: ^0.1.0-dev.5" to clipboard
stream_summary_builder: ^0.1.0-dev.5 copied to clipboard

outdated

An implementation of `StreamBuilderBase` that folds new stream events into a summary and builds with the summary of stream events seen so far.

example/lib/main.dart

import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:example/delayed_text.dart';
import 'package:stream_summary_builder/stream_summary_builder.dart';

void main() {
  runApp(MyApp());
}

class MyApp extends StatelessWidget {
  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Stream Summary Builder Demo',
      home: SafeArea(
        child: Scaffold(
          body: StreamSummaryBuilder<String, String>(
            initialData: '',
            fold: (summary, value) => summary + value,
            /// Simulates receiving text line by line from an asynchronous source
            stream: delayedText(),
            builder: _displayTextSummary
          ),
        ),
      ),
    );
  }

  Widget _displayTextSummary(BuildContext context, AsyncSnapshot<String> snapshot) {
    return Align(child: Text(snapshot.data ?? ''), alignment: Alignment.topLeft);
  }
}
2
likes
0
points
11
downloads

Publisher

verified publishercaseycrogers.dev

Weekly Downloads

An implementation of `StreamBuilderBase` that folds new stream events into a summary and builds with the summary of stream events seen so far.

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

flutter

More

Packages that depend on stream_summary_builder