Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class AmAuditReportIpFilterModel implements AmMultilineInputBaseModel {
- final String _id;
- String get id=>_id;
- String placeholder ='';
- final RegExp _regexpIp4 = new RegExp(r"^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$");
- final RegExp _regexpCIDR = new RegExp(r"^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])(\/([0-9]|[1-2][0-9]|3[0-2]))$");
- String value;
- bool isAddNewInput = true;
- bool isActive = true;
- bool isValid = true;
- validate(){
- if(quiver.emptyToNull(value)!=null){
- isValid = (_regexpIp4.stringMatch(value) != null) || (_regexpCIDR.stringMatch(value) !=null);
- }
- if (value != null && value.isEmpty) {
- isValid = true;
- }
- }
- AmAuditReportIpFilterModel(this._id, [this.value]);
- String toJson()=>value;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement