Hi Douglas Tybusch,

Thank you for taking the time to read our blog.

The ‘Validator’ is a helper class. Hence it was not included in the blog. We believe this is what you are looking for:

import ‘dart:async’;class Validators {
final validateEmail = StreamTransformer<String, String>.fromHandlers(
handleData: (String email, EventSink<String> sink) {
//A standard email check regex
Pattern pattern =
r’^(([^<>()[\]\\.,;:\s@\”]+(\.[^<>()[\]\\.,;:\s@\”]+)*)|(\”.+\”))@((\[[0–9]{1,3}\.[0–9]{1,3}\.[0–9]{1,3}\.[0–9]{1,3}\])|(([a-zA-Z\-0–9]+\.)+[a-zA-Z]{2,}))$’;
RegExp regex = new RegExp(pattern);
if (regex.hasMatch(email))
sink.add(email);
else
sink.addError(‘Enter a valid email’);
}
);
final validatePassword = StreamTransformer<String, String>.fromHandlers(
handleData: (String password, EventSink<String> sink) {
if (password.length > 7) {
sink.add(password);
} else {
sink.addError(‘Password must be at least 8 characters long’);
}
}
);
}

We hope this helps. Have a lovely day!

DLT Labs is a global leader in Distributed Ledger Technology and Enterprise Products. To know more, head over to: https://www.dltlabs.com/

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store