flutter-form-builder-ecosystem / flutter-form-builder-ecosystem/flutter_form_builder
Awaiting within valueTransformer
- Dominant language
- Dart
- Stars
- 1.6k
- Forks
- 561
- PR merge metrics
- No merged PRs in 30d
Description
Im not sure if this is a bug or my lack of understanding:
I want to use the valueTransformer method on a signature pad asynchronously while i wait for the signature to upload, however the call doesn't seem to be waiting for the return url before returning the value on submit
```
return FormBuilderSignaturePad(
name: 'signature',
controller: _controller,
decoration: InputDecoration(labelText: "signature"),
initialValue: _signatureFile?.readAsBytesSync(),
onSaved: (newValue) async {},
valueTransformer: (value) async {
final savedUrl = await processSignature(value, context);
return savedUrl;
},
onChanged: (value) {},
);
```
the return type when calling SaveAndValidate or Save then Validate is a string representation of the future
```
if (_currentStep <= _totalSteps - 1) {
_formKey[_currentStep].currentState.save();
if (_formKey[_currentStep].currentState.validate()) {
var request = firestoreDatabase.currentRequest;
//Value is in this case "Future" and not "http://urltoimage.co.uk"
var value = _formKey[_currentStep].currentState.value;
firestoreDatabase.updateRequest(request).then((value) {
if (_currentStep == _totalSteps - 1) {
//pop the screen
Navigator.pop(context);
} else {
setState(() {
_currentStep++;
});
}
});
}
}
```
any ideas if this is incorrectly programmed or a bug?
Contributor guide
Assessment
This issue has not been assessed yet.