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

14 lines
449 B
Dart
Raw Normal View History

2021-01-06 19:35:57 +02: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 17:39:44 +02:00
String? check(String val) {
2021-01-06 19:35:57 +02:00
var length = val.length;
var errorMassage = this.errorMassage.replaceAll("[]", length.toString());
return test(val) ? errorMassage : null;
}
}