RefParam class

When specifying a CollectionModelPath or DocumentModelPath field, you can load the referenced document together by specifying it in the field when referencing other documents.

Use with freezed, etc.

If this field is present, a ModelRefMixin is automatically assigned to the document.

CollectionModelPathDocumentModelPathの各フィールドを指定する際に他のドキュメントを参照するときにフィールドに指定することでその参照ドキュメントを合わせてロードすることができます。

freezedなどと共に利用してください。

このフィールドが存在する場合は、ドキュメントにModelRefMixinが自動で付与されます。

@freezed
@formValue
@immutable
@CollectionModelPath("shop")
class ShopModel with _$ShopModel {
  const factory ShopModel({
    @Default("") String name,
    @Default("") String description,
    ModelRef<UserModel> user,
  }) = _ShopModel;
  const ShopModel._();

  factory ShopModel.fromJson(Map<String, Object?> json) => _$ShopModelFromJson(json);

  static const document = _$ShopModelDocumentQuery();

  static const collection = _$ShopModelCollectionQuery();
}
Available Extensions

Constructors

RefParam()
When specifying a CollectionModelPath or DocumentModelPath field, you can load the referenced document together by specifying it in the field when referencing other documents.
const

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

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