multi_value_listenable_builder 0.0.2 copy "multi_value_listenable_builder: ^0.0.2" to clipboard
multi_value_listenable_builder: ^0.0.2 copied to clipboard

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

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.

31
likes
160
pub points
91%
popularity

Publisher

unverified uploader

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

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

flutter

More

Packages that depend on multi_value_listenable_builder