Search packages, repositories and app categories

Package detailsv0.0.2

multi_value_listenable_builder

A Flutter package which allows to listening to multiple ValueListenables using a single widget.

AndroidiOSWebmacOSWindowsLinux
30-day downloads
4.8K
Likes
34
Pub points
160

Install package

flutter pub add multi_value_listenable_builder

Package Overview

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

A Flutter package that enables listening to multiple ValueListenables through a single widget, simplifying state management in complex UIs. It reduces boilerplate by allowing developers to combine several ValueListenables into one listener, triggering rebuilds when any of the listened values change. Ideal for scenarios where multiple data sources influence a single widget's appearance or behavior. The package is lightweight and integrates seamlessly with existing Flutter state management patterns.

Use cases

  • Listening to multiple form fields
  • Updating UI based on several state variables
  • Synchronizing UI with multiple data streams
  • Managing complex form validation
  • Reducing nested listeners in UI trees

Key features

  • Single widget for multiple ValueListenables
  • Automatic rebuild on any value change
  • Minimal boilerplate
  • Composable with other widgets
  • Lightweight and efficient

Suitable for

  • Complex forms
  • Stateful widgets with multiple dependencies
  • UIs requiring synchronized updates
  • Developers using ValueNotifier
  • Projects avoiding heavy state management frameworks

Considerations

  • Requires understanding of ValueListenable
  • May increase complexity if overused
  • Not suitable for very large state graphs
  • Best used with simple or moderate state combinations
  • Limited to ValueListenable types only

Original README

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

MultiValueListenableBuilder

A widget to listen to multiple ValueListenables in Flutter.

pub

Usage

  • Add the multi_value_listenable_builder as a dependency in your project.

  • Import package:multi_value_listenable_builder/multi_value_listenable_builder.dart in required files.

  • Use MultiValueListenableBuilder just like any other widget.

import 'package:multi_value_listenable_builder/multi_value_listenable_builder.dart';

MultiValueListenableBuilder(
    // Add all ValueListenables here.
    valueListenables: [
        listenable0,
        listenable1,
        listenable2,
        .
        .
        listenableN
    ],
    builder: (context, values, child) {
        // Get the updated value of each listenable
        // in values list.
        return YourWidget(
            values.elementAt(0),
            values.elementAt(1),
            values.elementAt(2),
            .
            .
            values.elementAt(N),
            child: child // Optional child.
        );
    },
    child: YourOptionalChildWidget(),
)

A detailed and working example can be found here.

Categories

Source repository

Projects using this package