artflutter / reactive_forms_generator

Other
89 stars 22 forks source link

The element type 'Map<String, dynamic>? Function(AbstractControl<dynamic>)' can't be assigned to the list type 'Validator<String>' #127

Closed stact closed 1 year ago

stact commented 1 year ago

I'm following the documentation to use the requiredValidator, but I've a mismatch with the type.

Screenshot 2023-08-14 at 15 42 22

The element type 'Map<String, dynamic>? Function(AbstractControl<dynamic>)' can't be assigned to the list type 'Validator<String>'

Do you know what's changed? thank you! @vasilich6107

BenjiFarquhar commented 1 year ago

@stact Are you importing requiredValidator from reactive_forms? That type has recently changed to a Validator in the newer releases. So maybe your version of reactive_forms is old? Mine is working with 16.0.2.

EDIT: Actually, I think you need to change your validator to RequiredValidator(). I notice it is that in the example project, but maybe the docs have not yet been updated.

vasilich6107 commented 1 year ago

Hi @stact Check the example https://github.com/artflutter/reactive_forms_generator/blob/master/packages/reactive_forms_generator/example/lib/docs/login/login.dart#L23

README is a little bit outdated

vasilich6107 commented 1 year ago

@stact any feedback

vasilich6107 commented 1 year ago

updated the docs

github-actions[bot] commented 1 year ago

Hi @stact! Your issue has been closed. If we were helpful don't forget to star the repo.

Please check our reactive_forms_widget package

We would appreciate sponsorship subscription or one time donation https://github.com/sponsors/artflutter

stact commented 1 year ago

Hi @vasilich6107 sorry coming back from holidays :) it's better! Thank you!