controller_builder 1.0.0+1 copy "controller_builder: ^1.0.0+1" to clipboard
controller_builder: ^1.0.0+1 copied to clipboard

Widget for abstracting initializing and disposing TextEditingController, ChangeNotifiers, etc.

controller_builder #

style: very good analysis License: MIT

Widget that abstracts common initialization and disposing of TextEditingController, ChangeNotifier, etc.

ControllerBuilder<TextEditingController>(
  // Create a controller (or any `ChangeNotifier`).
  create: () {
    final controller = TextEditingController(text: 'Hello, world!');
    return controller..addListener(someListener);
  },

  // The controller you created in now available in the `builder` below.
  builder: (context, controller) {
    return TextField(
      controller: controller,
      onChanged: log,
    );
  },

  // Dispose will be called automatically unless
  // you provide a `dispose` callback like below.
  // You assume responsibility to call dispose then.
  dispose: (controller) {
    controller
      ..removeListener(someListener)
      ..dispose();
  },
)
0
likes
160
pub points
0%
popularity

Publisher

unverified uploader

Widget for abstracting initializing and disposing TextEditingController, ChangeNotifiers, etc.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

flutter

More

Packages that depend on controller_builder