From 4d3921d28eb0a0450011f03d10df3c934b726af3 Mon Sep 17 00:00:00 2001 From: Eray Erdin Date: Tue, 6 Dec 2022 15:45:33 +0300 Subject: [PATCH] add docs to readme --- README.md | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/README.md b/README.md index 8ebc164b4a..6fa1aa25f3 100644 --- a/README.md +++ b/README.md @@ -319,6 +319,27 @@ FormBuilderTextField( ), ``` +#### Stream for Real-time Form Changes + +You can subscribe to the stream on [FormBuilderState.onChanged](https://pub.dev/documentation/flutter_form_builder/latest/flutter_form_builder/FormBuilderState/onChanged.html) in order to react to the changes in real-time. You can use this stream in a `StreamBuilder` widget, an example would be: + +```dart +StreamBuilder( + stream: _formKey.currentState?.onChanged, + builder: (context, AsyncSnapshot snapshot) { + if (!snapshot.hasData) { + // if there are data, render a widget + } else { + // if there are no data, render a widget + } + }, +) +``` + +You can see a further example in the example app. + +You can also use this stream with [Bloc library](https://bloclibrary.dev). + ## Support ### Contribute