ListDataBuilder<T> class sealed

A sealed class that defines how a list of data should be displayed.

It contains two subclasses: ListDataBuilderString and ListDataBuilderCustom.

ListDataBuilderString is used to display a list of data as strings. It takes a labelBuilder which is a function that takes a data and returns a string label for the data.

ListDataBuilderCustom is used to display a list of data as custom widgets. It takes a builder which is a function that takes a build context, a data, and a ListTileMetadata object, and returns a widget for the data.

Available extensions
Annotations
  • @freezed

Constructors

ListDataBuilder.custom({required Widget builder(BuildContext context, T data, ListTileMetadata metadata)})
A factory to create a ListDataBuilder that displays a list of data as custom widgets.
const
factory
ListDataBuilder.string({required String labelBuilder(T data), ListDataTileStyle? style})
A factory to create a ListDataBuilder that displays a list of data as strings.
const
factory

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

map<TResult extends Object?>({required TResult string(ListDataBuilderString<T> value), required TResult custom(ListDataBuilderCustom<T> value)}) → TResult

Available on ListDataBuilder<T>, provided by the ListDataBuilderPatterns extension

A switch-like method, using callbacks.
mapOrNull<TResult extends Object?>({TResult? string(ListDataBuilderString<T> value)?, TResult? custom(ListDataBuilderCustom<T> value)?}) → TResult?

Available on ListDataBuilder<T>, provided by the ListDataBuilderPatterns extension

A variant of map that fallback to returning null.
maybeMap<TResult extends Object?>({TResult string(ListDataBuilderString<T> value)?, TResult custom(ListDataBuilderCustom<T> value)?, required TResult orElse()}) → TResult

Available on ListDataBuilder<T>, provided by the ListDataBuilderPatterns extension

A variant of map that fallback to returning orElse.
maybeWhen<TResult extends Object?>({TResult string(String labelBuilder(T data), ListDataTileStyle? style)?, TResult custom(Widget builder(BuildContext context, T data, ListTileMetadata metadata))?, required TResult orElse()}) → TResult

Available on ListDataBuilder<T>, provided by the ListDataBuilderPatterns extension

A variant of when that fallback to an orElse callback.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited
when<TResult extends Object?>({required TResult string(String labelBuilder(T data), ListDataTileStyle? style), required TResult custom(Widget builder(BuildContext context, T data, ListTileMetadata metadata))}) → TResult

Available on ListDataBuilder<T>, provided by the ListDataBuilderPatterns extension

A switch-like method, using callbacks.
whenOrNull<TResult extends Object?>({TResult? string(String labelBuilder(T data), ListDataTileStyle? style)?, TResult? custom(Widget builder(BuildContext context, T data, ListTileMetadata metadata))?}) → TResult?

Available on ListDataBuilder<T>, provided by the ListDataBuilderPatterns extension

A variant of when that fallback to returning null

Operators

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