selfprivacy.org.app/lib/logic/cubit/forms/validations/validations.dart

14 lines
449 B
Dart
Raw Normal View History

2021-01-06 17:35:57 +00:00
import 'package:cubit_form/cubit_form.dart';
class LegnthStringValidationWithLenghShowing extends ValidationModel<String> {
LegnthStringValidationWithLenghShowing(int length, String errorText)
: super((n) => n.length != length, errorText);
@override
2021-03-15 15:39:44 +00:00
String? check(String val) {
2021-01-06 17:35:57 +00:00
var length = val.length;
var errorMassage = this.errorMassage.replaceAll("[]", length.toString());
return test(val) ? errorMassage : null;
}
}