form_bloc 0.11.1 form_bloc: ^0.11.1 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(
isRequired: true,
validators: [
FieldBlocValidators.email,
],
);
final password = TextFieldBloc(
isRequired: true,
);
LoginFormBloc() {
addFieldBlocs(
fieldBlocs: [
email,
password,
],
);
}
@override
void onSubmitting() {
print(email.value);
print(password.value);
}
}