Skip to content
pubscout

reactive_forms_generator

8.5.0, released 3 months ago by an unverified publisher

Generator for type-safe reactive forms based on data models.

$ flutter pub add reactive_forms_generator
Source repository

What it does

Generates type-safe form classes, controls, and builders based on annotated model classes to work with the reactive_forms package.

AI-written summary of version 8.5.0, based on the package's README and metadata. Report an inaccuracy

Use it when

  • You want to avoid boilerplate code when building forms with reactive_forms
  • You want compile-time safety and type-safe form values instead of handling dynamic maps

Skip it when

  • You prefer writing your forms manually without using code generation
  • You are not using the reactive_forms package

Strengths

  • Eliminates boilerplate string identifiers and manual type casting for form values
  • Provides static type checks for form fields
  • Supports complex features like form arrays, nested form groups, and freezed models

Weaknesses

  • Requires setting up build_runner and code generation steps
  • Tight coupling with the reactive_forms ecosystem

Setup

Kind
Pure Dart
Effort
Medium
Code generation
Yes (build_runner)
Direct dependencies
9

Requires adding build_runner, reactive_forms, and reactive_forms_annotations to your pubspec, and executing code generation via build_runner.

import 'package:reactive_forms_annotations/reactive_forms_annotations.dart';

@Rf()
class Basic {
  final String email;
  final String password;

  Basic({
    @RfControl(validators: const [RequiredValidator()]) this.email = '',
    @RfControl(validators: const [RequiredValidator()]) this.password = '',
  });
}

Alternatives

Packages that do the same job and could replace reactive_forms_generator.

Works with

Packages commonly used together with reactive_forms_generator: ones it builds on, ones built on it, and its own family.