SubSpec<U> class final

Immutable description of one level in a sub-collection tree. Used with Query.watchWithTree to declare a parent → children → ... shape that the library will live-orchestrate.

Each SubSpec declares the subName under which this level lives, the subDefaultExpiration for items written through it, and an optional subFromJson + subTypeTag pair (required together if either is supplied, same rule as AtCollection.subCollection). Nested children describe further levels deeper in the tree.

SubSpec<Comment>(
  subName: 'comments',
  subDefaultExpiration: const Duration(days: 30),
  subFromJson: Comment.fromJson,
  subTypeTag: 'Comment',
  children: [
    SubSpec<Reply>(
      subName: 'replies',
      subDefaultExpiration: const Duration(days: 30),
      subFromJson: Reply.fromJson,
      subTypeTag: 'Reply',
    ),
  ],
);

Constructors

SubSpec({required String subName, required Duration subDefaultExpiration, U subFromJson(Map<String, dynamic>)?, String? subTypeTag, List<SubSpec> children = const []})
const

Properties

children → List<SubSpec>
final
hashCode → int
The hash code for this object.
no setterinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
subDefaultExpiration → Duration
final
subFromJson → U Function(Map<String, dynamic>)?
final
subName → String
final
subTypeTag → String?
final

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() → String
A string representation of this object.
inherited

Operators

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