controller_builder

Creator: coderz1093

Last updated:

0 purchases

controller_builder Image
controller_builder Images

Languages

Categories

Add to Cart

Description:

controller builder

controller_builder #


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();
},
)
copied to clipboard

License

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Files In This Product:

Customer Reviews

There are no reviews.