Comments (5)
Fixed in v0.1.6-next. I published as prerelease since there's some breaking changes.
from form-validator.
I'm thinking about using Map<String, String>
for storing i18n messages rather than classes.
final localeData = <String, String>{
'min_length': 'Must be at least {min} characters',
};
FormValidator.addLocale('en', localeData);
addLocale
will merge new locale data with previous data, so you can append custom validation messages too.
FormValidator.addLocale('en', {
'custom_validation': 'lorem ipsum dolor ...',
});
What do you think about that?
Some other methods would be added too, for example addMessage
to add single message in multiple languages:
FormValidator.addMessage('custom_validation', {
'en': '...',
'fr': '...',
...
});
from form-validator.
I think it would be a great solution for this problem 👍
from form-validator.
Hello ! I've just tried this new version but i'm getting this error :
Unsupported operation: Cannot set value in unmodifiable Map
When the exception was thrown, this was the stack
#0 _ImmutableMap.[]= (dart:core-patch/immutable_map.dart:74:5)
#1 LocalizationImpl.addMessage package:form_validator/src/localization_impl.dart:25
I couldn't found where this come from but maybe the Localdata is only accessible via "get" only somewhere.
from form-validator.
Hello ! I've just tried this new version but i'm getting this error :
Unsupported operation: Cannot set value in unmodifiable Map When the exception was thrown, this was the stack #0 _ImmutableMap.[]= (dart:core-patch/immutable_map.dart:74:5) #1 LocalizationImpl.addMessage package:form_validator/src/localization_impl.dart:25
I couldn't found where this come from but maybe the Localdata is only accessible via "get" only somewhere.
Thanks for reporting. I think const <String, String>{ ... }
maps become read-only maps.
from form-validator.
Related Issues (20)
- Splitting required into notBlank and notNull HOT 1
- email validator pass 'test@test ' HOT 1
- url method documentation typo HOT 1
- Adding null safety? HOT 3
- Required not working
- Is there any way to get validation as bool? HOT 4
- PatternValidator's pattern param should be type of `String` rather than `Pattern`, which is ambiguous HOT 1
- Leverage validators package instead of writing our own regexp HOT 4
- Add isEmpty on required string HOT 2
- using `required()` on an `optional` field does nothing
- Always required HOT 1
- Double can be null but less then some double value in TextFormField. HOT 1
- form_validator v2.0.0 HOT 4
- Passing `ValidationBuilder()` to validator has this error HOT 3
- Add a method to add locale to the supported list (instead of using the globalLocale HOT 1
- Passing the data in the text editing controller to the validation builder custom extension HOT 2
- Number input validator
- Add DropdownButtonFormField Support HOT 1
- How to add a prefix? HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from form-validator.