Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/luckey-elijah/controller_builder
Widget for abstracting initializing and disposing TextEditingController, ChangeNotifiers, etc.
https://github.com/luckey-elijah/controller_builder
Last synced: about 1 month ago
JSON representation
Widget for abstracting initializing and disposing TextEditingController, ChangeNotifiers, etc.
- Host: GitHub
- URL: https://github.com/luckey-elijah/controller_builder
- Owner: Luckey-Elijah
- License: mit
- Created: 2022-09-02T02:22:46.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2022-09-02T13:25:19.000Z (about 2 years ago)
- Last Synced: 2024-10-03T07:43:34.042Z (about 2 months ago)
- Language: Dart
- Size: 185 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# `controller_builder`
[![style: very good analysis][very_good_analysis_badge]][very_good_analysis_link]
[![License: MIT][license_badge]][license_link]Widget that abstracts common initialization and disposing of
`TextEditingController`, `ChangeNotifier`, etc.```dart
ControllerBuilder(
// 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();
},
)
```[license_badge]: https://img.shields.io/badge/license-MIT-blue.svg
[license_link]: https://opensource.org/licenses/MIT
[very_good_analysis_badge]: https://img.shields.io/badge/style-very_good_analysis-B22C89.svg
[very_good_analysis_link]: https://pub.dev/packages/very_good_analysis