ReactiveMultiImagePicker<T> constructor

  1. Key? key,
  2. String? formControlName,
  3. FormControl<MultiImage<T>>? formControl,
  4. Map<String, ValidationMessageFunction>? validationMessages,
  5. ControlValueAccessor<MultiImage<T>, MultiImage<T>>? valueAccessor,
  6. ShowErrorsFunction? showErrors,
  7. InputDecoration? decoration,
  8. required ImagePickerBuilder<T> imagePickerBuilder,
  9. int maxImages = 300,
  10. bool enableCamera = false,
  11. CupertinoOptions cupertinoOptions = const CupertinoOptions(),
  12. MaterialOptions materialOptions = const MaterialOptions(),
  13. double disabledOpacity = 0.5,

Creates a ReactiveMultiImagePicker that contains a ReactiveMultiImagePicker.

Can optionally provide a formControl to bind this widget to a control.

Can optionally provide a formControlName to bind this ReactiveFormField to a FormControl.

Must provide one of the arguments formControl or a formControlName, but not both at the same time.

Can optionally provide a validationMessages argument to customize a message for different kinds of validation errors.

Can optionally provide a valueAccessor to set a custom value accessors. See ControlValueAccessor.

Can optionally provide a showErrors function to customize when to show validation messages. Reactive Widgets make validation messages visible when the control is INVALID and TOUCHED, this behavior can be customized in the showErrors function.


Binds a text field.

final form ={'email': Validators.required});

  formControlName: 'email',

Binds a text field directly with a FormControl.

final form ={'email': Validators.required});

  formControl: form.control('email'),

Customize validation messages

  formControlName: 'email',
  validationMessages: {
    ValidationMessage.required: 'The email must not be empty', 'The email must be a valid email',

Customize when to show up validation messages.

  formControlName: 'email',
  showErrors: (control) => control.invalid && control.touched && control.dirty,

For documentation about the various parameters, see the ReactiveMultiImagePicker class and ReactiveMultiImagePicker, the constructor.


  Key? key,
  String? formControlName,
  FormControl<MultiImage<T>>? formControl,
  Map<String, ValidationMessageFunction>? validationMessages,
  ControlValueAccessor<MultiImage<T>, MultiImage<T>>? valueAccessor,
  ShowErrorsFunction? showErrors,

  InputDecoration? decoration,
  required ImagePickerBuilder<T> imagePickerBuilder,
  int maxImages = 300,
  bool enableCamera = false,
  CupertinoOptions cupertinoOptions = const CupertinoOptions(),
  MaterialOptions materialOptions = const MaterialOptions(),
  double disabledOpacity = 0.5,
}) : super(
        key: key,
        formControl: formControl,
        formControlName: formControlName,
        valueAccessor: valueAccessor,
        validationMessages: validationMessages,
        showErrors: showErrors,
        builder: (field) {
          final value = field.value ?? MultiImage<T>();

          final InputDecoration effectiveDecoration = (decoration ??
                  const InputDecoration())

          String? pickerError;

          pickImage() async {
            try {
              final resultList = await MultiImagePicker.pickImages(
                maxImages: maxImages,
                enableCamera: enableCamera,
                selectedAssets: value.assets,
                cupertinoOptions: cupertinoOptions,
                materialOptions: materialOptions,

              field.didChange(value.copyWith(assets: resultList));
            } on Exception catch (e) {
              pickerError = e.toString();

          return InputDecorator(
            decoration: effectiveDecoration.copyWith(
              errorText: field.errorText ?? pickerError,
              enabled: field.control.enabled,
            child: IgnorePointer(
              ignoring: !field.control.enabled,
              child: Opacity(
                opacity: field.control.enabled ? 1 : disabledOpacity,
                child:, value, (images) {