cedvdb/phone_form_field

How do you use the localization delegate. Type `Set<LocalizationDelegate<dynamic>>` cannot be assigned to `LocalizationDelegate<dynamic>`

Lionapi opened this issue · 2 comments

When i use the new version of phone_form_field i got an error, where should i place it correctly ?
error_flutter

localizationsDelegates: const [
GlobalMaterialLocalizations.delegate,
GlobalWidgetsLocalizations.delegate,
GlobalCupertinoLocalizations.delegate,
PhoneFieldLocalization.delegates
],

Notice PhoneFieldLocalization.delegates is plural. Replace line 106 to 111 with:

localizationsDelegates: const [
   GlobalMaterialLocalizations.delegate,
   GlobalWidgetsLocalizations.delegate,
   GlobalCupertinoLocalizations.delegate,
   ...PhoneFieldLocalization.delegates
],

as said in the other issue. You can read about the dart spread operator in dart doc https://dart.dev/language/collections#:~:text=Spread%20operators,-%23&text=Dart%20supports%20the%20spread%20operator,multiple%20values%20into%20a%20collection.&text=For%20more%20details%20and%20examples,see%20the%20spread%20operator%20proposal.

Thanks a lot. It's working now you can close this issue.