listQueryParamsFromWire<T> function
ListQueryParams<T>
listQueryParamsFromWire<T>(
- Map<
String, dynamic> raw, - T fromElement(
- Object? json
- FieldResolver<
T> resolveField
Decode a ListQueryParams from a wire map.
This is deliberately hand-written rather than the generated fromWire:
the generated codec boundary-casts raw['filter'] to a ZorphyFilter<T>,
but a wire filter is a JSON map that must be BOUND to a typed field of T
first. resolveField maps a field pointer to the entity's erased
ZorphyField<T, Object?> — <T>Fields.all.byPointer is the canonical
resolver; an unknown pointer or op throws FormatException rather than
decoding into a predicate that cannot read the entity.
Implementation
ListQueryParams<T> listQueryParamsFromWire<T>(
Map<String, dynamic> raw,
T Function(Object? json) fromElement,
FieldResolver<T> resolveField,
) {
return ListQueryParams<T>.fromTrusted(
search: raw['search'] as String?,
limit: raw['limit'] as int?,
offset: raw['offset'] as int?,
params: raw['params'] as Map<String, dynamic>?,
filter: FilterConverter.fromJsonTyped<T>(
raw['filter'] as Map<String, dynamic>?,
resolveField,
),
sort: SortConverter.fromJsonTyped<T>(
raw['sort'] as Map<String, dynamic>?,
resolveField,
),
);
}