StructuredQuery.fromJson constructor

StructuredQuery.fromJson(
  1. Object? j
)

Implementation

factory StructuredQuery.fromJson(Object? j) {
  final json = j as Map<String, Object?>;
  return StructuredQuery(
    select: switch (json['select']) {
      null => null,
      Object $1 => StructuredQuery_Projection.fromJson($1),
    },
    from: switch (json['from']) {
      null => [],
      List<Object?> $1 => [
        for (final i in $1) StructuredQuery_CollectionSelector.fromJson(i),
      ],
      _ => throw const FormatException('"from" is not a list'),
    },
    where: switch (json['where']) {
      null => null,
      Object $1 => StructuredQuery_Filter.fromJson($1),
    },
    orderBy: switch (json['orderBy']) {
      null => [],
      List<Object?> $1 => [
        for (final i in $1) StructuredQuery_Order.fromJson(i),
      ],
      _ => throw const FormatException('"orderBy" is not a list'),
    },
    startAt: switch (json['startAt']) {
      null => null,
      Object $1 => Cursor.fromJson($1),
    },
    endAt: switch (json['endAt']) {
      null => null,
      Object $1 => Cursor.fromJson($1),
    },
    offset: switch (json['offset']) {
      null => 0,
      Object $1 => decodeInt($1),
    },
    limit: switch (json['limit']) {
      null => null,
      Object $1 => Int32Value.fromJson($1),
    },
    findNearest: switch (json['findNearest']) {
      null => null,
      Object $1 => StructuredQuery_FindNearest.fromJson($1),
    },
  );
}