Search packages, repositories and app categories

Package detailsv3.0.2

multiple_stream_builder

Flutter widgets to replace multiple nested StreamBuilder widgets

AndroidiOSWebmacOSWindowsLinux
30-day downloads
3.1K
Likes
38
Pub points
160

Install package

flutter pub add multiple_stream_builder

Package Overview

Package selection guidance compiled from public package information, community data, and project usage.

A Flutter package that simplifies working with multiple streams by replacing nested StreamBuilder widgets with a single, clean widget. It enables efficient and readable handling of multiple asynchronous data sources in a single build context, reducing boilerplate and improving performance. Ideal for UIs requiring concurrent updates from several streams, such as real-time dashboards or multi-data form inputs. The package supports all major platforms and integrates seamlessly with existing Flutter code.

Use cases

  • Real-time dashboards with multiple data feeds
  • Forms requiring live validation from multiple streams
  • Concurrent state updates from different sources
  • Simplified UI logic for multi-stream data
  • Reducing nesting in complex stream-based UIs

Key features

  • Single widget to manage multiple streams
  • Eliminates nested StreamBuilder complexity
  • Efficient rebuilds with minimal overhead
  • Supports all Flutter platforms
  • Clean, readable syntax for stream handling

Suitable for

  • Developers managing multiple async data sources
  • Teams seeking cleaner UI code
  • Projects with complex real-time data requirements
  • Flutter apps using reactive patterns
  • Those wanting to reduce widget tree depth

Considerations

  • Requires understanding of Stream and StreamBuilder basics
  • May increase bundle size slightly
  • Best suited for cases with 2+ concurrent streams
  • Not ideal for simple one-stream scenarios
  • Limited to stream-based data sources

Original README

Original README snapshot from the linked source repository. Visit the repository for the latest content.

multiple_stream_builder

Flutter widgets to replace multiple nested StreamBuilder widgets

Installing

To add use this package in your Flutter project add this to your pubspec.yml

dependencies:
  multiple_stream_builder: ^3.0.0

Usage example

var stream1 = Stream<int>.periodic(Duration(seconds: 1), (x) => x);
var stream2 = Stream<int>.periodic(Duration(seconds: 2), (x) => x);
var stream3 = Stream<int>.periodic(Duration(seconds: 3), (x) => x);

// Instead of writing out nested StreamBuilders
Widget build(BuildContext context) {
  return StreamBuilder<int>(
    stream: stream1,
    initialData: 0,
    builder: (context, snapshot1) {
      return StreamBuilder<int>(
        stream: stream2,
        initialData: 0,
        builder: (context, snapshot2) {
          return StreamBuilder<int>(
            stream: stream3,
            initialData: 0,
            builder: (context, snapshot3) {
              return Text(
                'stream1: ${snapshot1.data} - stream2: ${snapshot2.data} - stream3: ${snapshot3.data}',
              );
            },
          );
        },
      );
    },
  );
}

// Pass multiple streams into a single StreamBuilder
Widget build(BuildContext context) {
  return StreamBuilder3<int, int, int>(
    streams: StreamTuple3(stream1, stream2, stream3),
    initialData: InitialDataTuple3(0, 0, 0),
    builder: (context, snapshots) {
      return Text(
        'stream1: ${snapshots.snapshot1.data} - stream2: ${snapshots.snapshot2.data} - stream3: ${snapshots.snapshot3.data}',
      );
    },
  );
}

Categories

Source repository

Projects using this package

No data available yet.