AsyncListView<T> class

A wrapper around StreamSummaryBuilder and ListView that displays a scrollable list of lazily loaded stream elements.

AsyncListView is useful for loading a list of results from an asynchronous database. Example use cases:

  • display user chat history retrieved from Firestore.
  • display search results for items on an online marketplace.

T is the event type of the provided source stream.

Inheritance

Constructors

AsyncListView({Key? key, required Stream<T> stream, required IndexedSnapshotWidgetBuilder<T> itemBuilder, List<T>? initialData, Widget? loadingWidget, WidgetBuilder? noResultsWidgetBuilder, Axis scrollDirection = Axis.vertical, bool reverse = false, ScrollController? controller, bool? primary, ScrollPhysics? physics, bool shrinkWrap = false, EdgeInsetsGeometry? padding, double? itemExtent, bool addAutomaticKeepAlives = true, bool addRepaintBoundaries = true, bool addSemanticIndexes = true, double? cacheExtent, DragStartBehavior dragStartBehavior = DragStartBehavior.start, ScrollViewKeyboardDismissBehavior keyboardDismissBehavior = ScrollViewKeyboardDismissBehavior.manual, String? restorationId, Clip clipBehavior = Clip.hardEdge})
Creates an AsyncListView connected to the specified stream.
const

Properties

addAutomaticKeepAlives bool
See SliverChildListDelegate.addAutomaticKeepAlives.
final
addRepaintBoundaries bool
See SliverChildListDelegate.addRepaintBoundaries.
final
addSemanticIndexes bool
See SliverChildListDelegate.addSemanticIndexes.
final
cacheExtent double?
See ScrollView.cacheExtent.
final
clipBehavior Clip
See ScrollView.clipBehavior.
final
controller ScrollController?
See ScrollView.controller.
final
dragStartBehavior DragStartBehavior
See ScrollView.dragStartBehavior.
final
hashCode int
The hash code for this object.
no setterinherited
initialData List<T>?
Synchronously fetched data to seed the displayed ListView with. Stream events will be appended to initialData.
final
itemBuilder IndexedSnapshotWidgetBuilder<T>
See IndexedSnapshotWidgetBuilder.
final
itemExtent double?
See ListView.itemExtent.
final
key Key?
Controls how one widget replaces another widget in the tree.
finalinherited
keyboardDismissBehavior ScrollViewKeyboardDismissBehavior
See ScrollView.keyboardDismissBehavior.
final
loadingWidget Widget?
A Widget to display at the end of the contained ListView if the user scrolls to the bottom of the ListView before the source stream is done.
final
noResultsWidgetBuilder WidgetBuilder?
A Widget to display instead of the ListView if the source stream finishes without producing any events.
final
padding EdgeInsetsGeometry?
See ListView.padding.
final
physics ScrollPhysics?
See ScrollView.physics.
final
primary bool?
See ScrollView.primary.
final
restorationId String?
See ScrollView.restorationId.
final
reverse bool
See ScrollView.reverse.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
scrollDirection Axis
The following attributes are all passed directly through to ListView as constructor arguments. See ScrollView.scrollDirection.
final
shrinkWrap bool
See ScrollView.shrinkWrap.
final
stream Stream<T>
The Stream providing events for this ListView. AsyncListView will reuse an existing StreamSubscription if passed the same Stream twice so a non-broadcast stream can be safely used here.
final

Methods

createElement() StatefulElement
Creates a StatefulElement to manage this widget's location in the tree.
inherited
createState() → _AsyncListViewState<T>
Creates the mutable state for this widget at a given location in the tree.
override
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.
inherited
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}) 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