FMultiSelect<T> class abstract

A multi-select displays a list of options for the user to pick from.

It is a FormField and therefore can be used in a Form widget.

Why am I getting "No FMultiSelect<$T> found in context..." assertion errors?

This is likely because Dart could not infer FMultiSelect's type parameter. Try specifying the type parameter for FMultiSelect, FSelectSection, and FSelectItem (e.g., FMultiSelect<MyType>).

See:

Inheritance

Constructors

FMultiSelect({required Map<String, T> items, FMultiValueControl<T>? control, FPopoverControl popoverControl = const .managed(), FMultiSelectStyle style(FMultiSelectStyle style)?, bool autofocus = false, FocusNode? focusNode, FFieldIconBuilder<FMultiSelectStyle>? prefixBuilder, FFieldIconBuilder<FMultiSelectStyle>? suffixBuilder = defaultIconBuilder, Widget? label, Widget? description, bool enabled = true, void onSaved(Set<T> values)?, VoidCallback? onReset, AutovalidateMode autovalidateMode = .onUnfocus, String? forceErrorText, String? validator(Set<T> values) = _defaultValidator, Widget errorBuilder(BuildContext context, String message) = FFormFieldProperties.defaultErrorBuilder, Widget? hint, bool keepHint = true, int sort(T a, T b)?, Widget tagBuilder(BuildContext context, FMultiValueNotifier<T> controller, FMultiSelectStyle style, T value, Widget label)?, TextAlign textAlign = .start, TextDirection? textDirection, bool clearable = false, AlignmentGeometry contentAnchor = AlignmentDirectional.topStart, AlignmentGeometry fieldAnchor = AlignmentDirectional.bottomStart, FPortalConstraints contentConstraints = const FAutoWidthPortalConstraints(maxHeight: 300), FPortalSpacing contentSpacing = const .spacing(4), FPortalOverflow contentOverflow = .flip, Offset contentOffset = Offset.zero, FPopoverHideRegion contentHideRegion = .excludeChild, Object? contentGroupId, Widget contentEmptyBuilder(BuildContext context, FMultiSelectStyle style) = FMultiSelect.defaultContentEmptyBuilder, ScrollController? contentScrollController, bool contentScrollHandles = false, ScrollPhysics contentPhysics = const ClampingScrollPhysics(), FItemDivider contentDivider = .none, Key? key})
Creates a FMultiSelect from the given items.
factory
FMultiSelect.rich({required Widget format(T value), required List<FSelectItemMixin> children, FMultiValueControl<T>? control, FPopoverControl popoverControl, FMultiSelectStyle style(FMultiSelectStyle style)?, bool autofocus, FocusNode? focusNode, FFieldIconBuilder<FMultiSelectStyle>? prefixBuilder, FFieldIconBuilder<FMultiSelectStyle>? suffixBuilder, Widget? label, Widget? description, bool enabled, void onSaved(Set<T> values)?, VoidCallback? onReset, AutovalidateMode autovalidateMode, String? forceErrorText, String? validator(Set<T> values), Widget errorBuilder(BuildContext context, String message), Widget? hint, bool keepHint, int sort(T, T)?, FMultiSelectTagBuilder<T>? tagBuilder, TextAlign textAlign, TextDirection? textDirection, bool clearable, AlignmentGeometry contentAnchor, AlignmentGeometry fieldAnchor, FPortalConstraints contentConstraints, FPortalSpacing contentSpacing, FPortalOverflow contentOverflow, Offset contentOffset, FPopoverHideRegion contentHideRegion, Object? contentGroupId, Widget contentEmptyBuilder(BuildContext context, FMultiSelectStyle style), ScrollController? contentScrollController, bool contentScrollHandles, ScrollPhysics contentPhysics, FItemDivider contentDivider, Key? key})
Creates a FMultiSelect with the given children.
const
factory
FMultiSelect.search(Map<String, T> items, {FutureOr<Iterable<T>> filter(String query)?, FSelectSearchFieldProperties searchFieldProperties = const FSelectSearchFieldProperties(), Widget contentLoadingBuilder(BuildContext context, FSelectSearchStyle style) = FMultiSelect.defaultContentLoadingBuilder, Widget contentErrorBuilder(BuildContext context, Object? error, StackTrace stackTrace)?, FMultiValueControl<T>? control, FPopoverControl popoverControl = const .managed(), FMultiSelectStyle style(FMultiSelectStyle style)?, bool autofocus = false, FocusNode? focusNode, FFieldIconBuilder<FMultiSelectStyle>? prefixBuilder, FFieldIconBuilder<FMultiSelectStyle>? suffixBuilder = defaultIconBuilder, Widget? label, Widget? description, bool enabled = true, void onSaved(Set<T> values)?, VoidCallback? onReset, AutovalidateMode autovalidateMode = .onUnfocus, String? forceErrorText, String? validator(Set<T> values) = _defaultValidator, Widget errorBuilder(BuildContext context, String message) = FFormFieldProperties.defaultErrorBuilder, Widget? hint, bool keepHint = true, int sort(T, T)?, FMultiSelectTagBuilder<T>? tagBuilder, TextAlign textAlign = .start, TextDirection? textDirection, bool clearable = false, AlignmentGeometry contentAnchor = AlignmentDirectional.topStart, AlignmentGeometry fieldAnchor = AlignmentDirectional.bottomStart, FPortalConstraints contentConstraints = const FAutoWidthPortalConstraints(maxHeight: 300), FPortalSpacing contentSpacing = const .spacing(4), FPortalOverflow contentOverflow = .flip, Offset contentOffset = .zero, FPopoverHideRegion contentHideRegion = .excludeChild, Object? contentGroupId, Widget contentEmptyBuilder(BuildContext context, FMultiSelectStyle style) = defaultContentEmptyBuilder, ScrollController? contentScrollController, bool contentScrollHandles = false, ScrollPhysics contentPhysics = const ClampingScrollPhysics(), FItemDivider contentDivider = .none, Key? key})
Creates a searchable select with dynamic content based on the given items and search input.
factory
FMultiSelect.searchBuilder({required Widget format(T), required FutureOr<Iterable<T>> filter(String query), required FSelectSearchContentBuilder<T> contentBuilder, FSelectSearchFieldProperties searchFieldProperties, Widget contentLoadingBuilder(BuildContext context, FSelectSearchStyle style), Widget contentErrorBuilder(BuildContext context, Object? error, StackTrace stackTrace)?, FMultiValueControl<T>? control, FPopoverControl popoverControl, FMultiSelectStyle style(FMultiSelectStyle style)?, bool autofocus, FocusNode? focusNode, FFieldIconBuilder<FMultiSelectStyle>? prefixBuilder, FFieldIconBuilder<FMultiSelectStyle>? suffixBuilder, Widget? label, Widget? description, bool enabled, void onSaved(Set<T> values)?, VoidCallback? onReset, AutovalidateMode autovalidateMode, String? forceErrorText, String? validator(Set<T> values), Widget errorBuilder(BuildContext context, String message), Widget? hint, bool keepHint, int sort(T, T)?, FMultiSelectTagBuilder<T>? tagBuilder, TextAlign textAlign, TextDirection? textDirection, bool clearable, AlignmentGeometry contentAnchor, AlignmentGeometry fieldAnchor, FPortalConstraints contentConstraints, FPortalSpacing contentSpacing, FPortalOverflow contentOverflow, Offset contentOffset, FPopoverHideRegion contentHideRegion, Object? contentGroupId, Widget contentEmptyBuilder(BuildContext context, FMultiSelectStyle style), ScrollController? contentScrollController, bool contentScrollHandles, ScrollPhysics contentPhysics, FItemDivider contentDivider, Key? key})
Creates a searchable select with dynamic content based on search input.
const
factory

Properties

autofocus bool
True if this widget will be selected as the initial focus when no other node in its scope is currently focused.
final
autovalidateMode AutovalidateMode
Used to enable/disable this form field's auto validation and update its error text.
final
clearable bool
True if a clear button should be shown. Defaults to false.
final
contentAnchor AlignmentGeometry
The alignment point on the popover. Defaults to AlignmentDirectional.topStart.
final
contentConstraints FPortalConstraints
The constraints to apply to the popover. Defaults to const FAutoWidthPortalConstraints(maxHeight: 300).
final
contentDivider FItemDivider
The divider used to separate the content items. Defaults to FItemDivider.none.
final
contentEmptyBuilder Widget Function(BuildContext context, FMultiSelectStyle style)
The builder that is called when the select is empty. Defaults to FSelect.defaultContentEmptyBuilder.
final
contentGroupId Object?
An optional group ID that groups TapRegions together so that they operate as one region. If a tap occurs outside of all group members, then group members that are shown will be hidden.
final
contentHideRegion FPopoverHideRegion
The region that can be tapped to hide the popover.
final
contentOffset Offset
Additional translation to apply to the popover's position.
final
contentOverflow FPortalOverflow
The callback used to shift a popover when it overflows out of the viewport.
final
contentPhysics ScrollPhysics
The content's scroll physics. Defaults to ClampingScrollPhysics.
final
contentScrollController ScrollController?
The content's scroll controller.
final
contentScrollHandles bool
True if the content should show scroll handles instead of a scrollbar. Defaults to false.
final
contentSpacing FPortalSpacing
The spacing between the popover and child anchors.
final
control FMultiValueControl<T>?
The control that manages the multi-select's state.
final
description Widget?
The description.
final
enabled bool
Whether the form is able to receive user input.
final
errorBuilder Widget Function(BuildContext context, String message)
The builder for errors displayed below the description. Defaults to displaying the error message.
final
fieldAnchor AlignmentGeometry
The alignment point on the select's field. Defaults to AlignmentDirectional.bottomStart.
final
focusNode FocusNode?
An optional focus node to use as the focus node for this widget.
final
forceErrorText String?
An optional property that forces the FormFieldState into an error state by directly setting the FormFieldState.errorText property without running the validator function.
final
format Widget Function(T value)
The function formats the value for display in the select's field.
final
hashCode int
The hash code for this object.
no setterinherited
hint Widget?
The hint.
final
keepHint bool
Whether to keep the hint visible when there are selected items. Defaults to true.
final
key Key?
Controls how one widget replaces another widget in the tree.
finalinherited
label Widget?
The label.
final
onReset VoidCallback?
An optional method to call when the form field is reset via FormFieldState.reset.
final
onSaved → void Function(Set<T> values)?
An optional method to call with the final value when the form is saved via FormState.save.
final
popoverControl FPopoverControl
Defines how the multi-select's popover is controlled.
final
prefixBuilder FFieldIconBuilder<FMultiSelectStyle>?
Builds a widget at the start of the select that can be pressed to toggle the popover. Defaults to no icon.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
sort int Function(T a, T b)?
The function used to sort the selected items. Defaults to the order in which they were selected.
final
style FMultiSelectStyle Function(FMultiSelectStyle style)?
The style.
final
suffixBuilder FFieldIconBuilder<FMultiSelectStyle>?
Builds a widget at the end of the select that can be pressed to toggle the popover. Defaults to defaultIconBuilder.
final
tagBuilder FMultiSelectTagBuilder<T>
The function used to build the tags for selected items.
final
textAlign TextAlign
The alignment of the text within the select. Defaults to TextAlign.start.
final
textDirection TextDirection?
The text direction of the select.
final
validator String? Function(Set<T> values)
An optional method that validates an input. Returns an error string to display if the input is invalid, or null otherwise.
final

Methods

createElement() StatefulElement
Creates a StatefulElement to manage this widget's location in the tree.
inherited
createState() State<StatefulWidget>
Creates the mutable state for this widget at a given location in the tree.
inherited
debugDescribeChildren() List<DiagnosticsNode>
Returns a list of DiagnosticsNode objects describing this node's children.
inherited
debugFillProperties(DiagnosticPropertiesBuilder properties) → void
Add additional properties associated with the node.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toDiagnosticsNode({String? name, DiagnosticsTreeStyle? style}) DiagnosticsNode
Returns a debug representation of the object that is used by debugging tools and by DiagnosticsNode.toStringDeep.
inherited
toString({DiagnosticLevel minLevel = DiagnosticLevel.info}) String
A string representation of this object.
inherited
toStringDeep({String prefixLineOne = '', String? prefixOtherLines, DiagnosticLevel minLevel = DiagnosticLevel.debug, int wrapWidth = 65}) String
Returns a string representation of this node and its descendants.
inherited
toStringShallow({String joiner = ', ', DiagnosticLevel minLevel = DiagnosticLevel.debug}) String
Returns a one-line detailed description of the object.
inherited
toStringShort() String
A short, textual description of this widget.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Methods

defaultContentEmptyBuilder(BuildContext context, FMultiSelectStyle style) Widget
The default content empty builder that shows a localized message when there are no results.
defaultContentLoadingBuilder(BuildContext _, FSelectSearchStyle style) Widget
The default loading builder that shows a spinner when an asynchronous search is pending.
defaultIconBuilder(BuildContext _, FMultiSelectStyle style, Set<WidgetState> states) Widget
The default suffix builder that shows a upward and downward facing chevron icon.
defaultTagBuilder<T>(BuildContext context, FMultiValueNotifier<T> controller, FMultiSelectStyle style, T value, Widget label) Widget
The default tag builder that builds a FMultiSelectTag with the given value.