form_bloc 0.20.7-alpha form_bloc: ^0.20.7-alpha copied to clipboard
Easy Form State Management using BLoC pattern. Separate the Form State and Business Logic from the User Interface. Async Validation, Progress, Dynamic fields, and more.
import 'package:form_bloc/form_bloc.dart';
class LoginFormBloc extends FormBloc<String, String> {
final email = TextFieldBloc(
validators: [
FieldBlocValidators.required,
FieldBlocValidators.email,
],
);
final password = TextFieldBloc(
validators: [
FieldBlocValidators.required,
],
);
LoginFormBloc() {
addFieldBlocs(
fieldBlocs: [
email,
password,
],
);
}
@override
void onSubmitting() {
print(email.value);
print(password.value);
}
}