From e73305482367ea51b6463fbe8a7be27d1b57ade3 Mon Sep 17 00:00:00 2001 From: dorklein Date: Wed, 5 Mar 2025 14:43:59 +0200 Subject: [PATCH 1/7] Update cloud_firestore_odm to support Freezed 3.0.0 and latest dependencies - Resolve compatibility issues with Freezed 3.0.0 and above - Update Dart SDK to >=3.0.0 - Upgrade dependencies to latest versions - Add support for Freezed mixed mode classes - Update generator to handle new Freezed class structures - Improve compatibility with newer analyzer and source_gen versions --- README.md | 8 +- packages/cloud_firestore_odm/CHANGELOG.md | 6 + packages/cloud_firestore_odm/README.md | 6 + .../example/lib/integration.g.dart | 2 +- .../example/lib/integration/freezed.dart | 4 +- .../lib/integration/freezed.freezed.dart | 358 +++--- .../example/lib/integration/freezed.g.dart | 170 ++- .../cloud_firestore_odm/example/pubspec.yaml | 14 +- packages/cloud_firestore_odm/pubspec.yaml | 9 +- .../CHANGELOG.md | 6 + .../lib/freezed.dart | 19 +- .../lib/freezed.freezed.dart | 403 +++--- .../lib/freezed.g.dart | 1137 +++++++++++++++-- .../pubspec.yaml | 18 +- .../test/collection_test.dart | 23 +- .../test/setup_firestore_mock.dart | 52 +- .../lib/src/collection_data.dart | 23 +- .../lib/src/validator_generator.dart | 2 +- .../pubspec.yaml | 36 +- 19 files changed, 1684 insertions(+), 612 deletions(-) diff --git a/README.md b/README.md index 5633a8b..f7a4df6 100644 --- a/README.md +++ b/README.md @@ -23,6 +23,12 @@ The ODM allows data schemas to be defined which represent the data structure of - 🎯 Data selectors to help avoid unnecessary Widget rebuilds. - 💻 Full API code completion. +## Compatibility + +- **Freezed**: Compatible with Freezed 3.0.0 and above +- **Analyzer**: Supports analyzer 7.0.0 and above +- **Source Gen**: Compatible with source_gen 2.0.0 and above + ## Installation ### 1. Use a recent Dart version @@ -34,7 +40,7 @@ That is done by adding the following to your `pubspec.yaml`: ```yaml environment: - sdk: ">=2.18.0 <4.0.0" + sdk: ">=3.0.0 <4.0.0" ``` ### 2. FlutterFire Initialization diff --git a/packages/cloud_firestore_odm/CHANGELOG.md b/packages/cloud_firestore_odm/CHANGELOG.md index aec44da..1ccb554 100644 --- a/packages/cloud_firestore_odm/CHANGELOG.md +++ b/packages/cloud_firestore_odm/CHANGELOG.md @@ -1,3 +1,9 @@ +## 1.1.0 + +- **FIX**: Resolve compatibility issues with Freezed 3.0.0 and above +- **FEAT**: Support analyzer 7.0.0 and above +- **CHORE**: Update dependencies to latest versions + ## 1.0.0-dev.88 - **BREAKING**: Removes `set` methods from `FirestoreDocumentReference` to make way for generated methods diff --git a/packages/cloud_firestore_odm/README.md b/packages/cloud_firestore_odm/README.md index f3bf4c2..3ccd508 100755 --- a/packages/cloud_firestore_odm/README.md +++ b/packages/cloud_firestore_odm/README.md @@ -7,6 +7,12 @@ To learn more about Firebase Cloud Firestore, please visit the [Firebase website [![pub package](https://img.shields.io/pub/v/cloud_firestore_odm.svg)](https://pub.dev/packages/cloud_firestore_odm) +## Compatibility + +- **Freezed**: Compatible with Freezed 3.0.0 and above +- **Analyzer**: Supports analyzer 7.0.0 and above +- **Source Gen**: Compatible with source_gen 2.0.0 and above + ## Getting Started To get started with Cloud Firestore for Flutter, please [see the documentation](https://github.com/firebaseextended/firestoreodm-flutter/tree/main/docs). diff --git a/packages/cloud_firestore_odm/example/lib/integration.g.dart b/packages/cloud_firestore_odm/example/lib/integration.g.dart index 0ea7bee..71f4646 100644 --- a/packages/cloud_firestore_odm/example/lib/integration.g.dart +++ b/packages/cloud_firestore_odm/example/lib/integration.g.dart @@ -1,6 +1,6 @@ // GENERATED CODE - DO NOT MODIFY BY HAND -// ignore_for_file: type=lint, type=warning +// ignore_for_file: type=lint part of 'integration.dart'; diff --git a/packages/cloud_firestore_odm/example/lib/integration/freezed.dart b/packages/cloud_firestore_odm/example/lib/integration/freezed.dart index 4453f8b..483385a 100644 --- a/packages/cloud_firestore_odm/example/lib/integration/freezed.dart +++ b/packages/cloud_firestore_odm/example/lib/integration/freezed.dart @@ -13,7 +13,7 @@ part 'freezed.g.dart'; @Collection('freezed-test') @freezed -class Person with _$Person { +abstract class Person with _$Person { @JsonSerializable(fieldRename: FieldRename.snake) factory Person({ required String firstName, @@ -28,7 +28,7 @@ final personRef = PersonCollectionReference(); @Collection('freezed-test') @freezed -class PublicRedirected with _$PublicRedirected { +abstract class PublicRedirected with _$PublicRedirected { factory PublicRedirected({required String value}) = PublicRedirected2; factory PublicRedirected.fromJson(Map json) => diff --git a/packages/cloud_firestore_odm/example/lib/integration/freezed.freezed.dart b/packages/cloud_firestore_odm/example/lib/integration/freezed.freezed.dart index 5c1d22c..aa734d6 100644 --- a/packages/cloud_firestore_odm/example/lib/integration/freezed.freezed.dart +++ b/packages/cloud_firestore_odm/example/lib/integration/freezed.freezed.dart @@ -1,3 +1,4 @@ +// dart format width=80 // coverage:ignore-file // GENERATED CODE - DO NOT MODIFY BY HAND // ignore_for_file: type=lint @@ -9,85 +10,53 @@ part of 'freezed.dart'; // FreezedGenerator // ************************************************************************** +// dart format off T _$identity(T value) => value; -final _privateConstructorUsedError = UnsupportedError( - 'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models'); - -Person _$PersonFromJson(Map json) { - return _Person.fromJson(json); -} - /// @nodoc mixin _$Person { - String get firstName => throw _privateConstructorUsedError; + String get firstName; @JsonKey(name: 'LAST_NAME') - String get lastName => throw _privateConstructorUsedError; + String get lastName; @JsonKey(includeFromJson: false, includeToJson: false) - int? get ignored => throw _privateConstructorUsedError; - - /// Serializes this Person to a JSON map. - Map toJson() => throw _privateConstructorUsedError; + int? get ignored; /// Create a copy of Person /// with the given fields replaced by the non-null parameter values. @JsonKey(includeFromJson: false, includeToJson: false) - $PersonCopyWith get copyWith => throw _privateConstructorUsedError; -} + @pragma('vm:prefer-inline') + $PersonCopyWith get copyWith => + _$PersonCopyWithImpl(this as Person, _$identity); -/// @nodoc -abstract class $PersonCopyWith<$Res> { - factory $PersonCopyWith(Person value, $Res Function(Person) then) = - _$PersonCopyWithImpl<$Res, Person>; - @useResult - $Res call( - {String firstName, - @JsonKey(name: 'LAST_NAME') String lastName, - @JsonKey(includeFromJson: false, includeToJson: false) int? ignored}); -} + /// Serializes this Person to a JSON map. + Map toJson(); -/// @nodoc -class _$PersonCopyWithImpl<$Res, $Val extends Person> - implements $PersonCopyWith<$Res> { - _$PersonCopyWithImpl(this._value, this._then); + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is Person && + (identical(other.firstName, firstName) || + other.firstName == firstName) && + (identical(other.lastName, lastName) || + other.lastName == lastName) && + (identical(other.ignored, ignored) || other.ignored == ignored)); + } - // ignore: unused_field - final $Val _value; - // ignore: unused_field - final $Res Function($Val) _then; + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => Object.hash(runtimeType, firstName, lastName, ignored); - /// Create a copy of Person - /// with the given fields replaced by the non-null parameter values. - @pragma('vm:prefer-inline') @override - $Res call({ - Object? firstName = null, - Object? lastName = null, - Object? ignored = freezed, - }) { - return _then(_value.copyWith( - firstName: null == firstName - ? _value.firstName - : firstName // ignore: cast_nullable_to_non_nullable - as String, - lastName: null == lastName - ? _value.lastName - : lastName // ignore: cast_nullable_to_non_nullable - as String, - ignored: freezed == ignored - ? _value.ignored - : ignored // ignore: cast_nullable_to_non_nullable - as int?, - ) as $Val); + String toString() { + return 'Person(firstName: $firstName, lastName: $lastName, ignored: $ignored)'; } } /// @nodoc -abstract class _$$PersonImplCopyWith<$Res> implements $PersonCopyWith<$Res> { - factory _$$PersonImplCopyWith( - _$PersonImpl value, $Res Function(_$PersonImpl) then) = - __$$PersonImplCopyWithImpl<$Res>; - @override +abstract mixin class $PersonCopyWith<$Res> { + factory $PersonCopyWith(Person value, $Res Function(Person) _then) = + _$PersonCopyWithImpl; @useResult $Res call( {String firstName, @@ -96,12 +65,11 @@ abstract class _$$PersonImplCopyWith<$Res> implements $PersonCopyWith<$Res> { } /// @nodoc -class __$$PersonImplCopyWithImpl<$Res> - extends _$PersonCopyWithImpl<$Res, _$PersonImpl> - implements _$$PersonImplCopyWith<$Res> { - __$$PersonImplCopyWithImpl( - _$PersonImpl _value, $Res Function(_$PersonImpl) _then) - : super(_value, _then); +class _$PersonCopyWithImpl<$Res> implements $PersonCopyWith<$Res> { + _$PersonCopyWithImpl(this._self, this._then); + + final Person _self; + final $Res Function(Person) _then; /// Create a copy of Person /// with the given fields replaced by the non-null parameter values. @@ -112,17 +80,17 @@ class __$$PersonImplCopyWithImpl<$Res> Object? lastName = null, Object? ignored = freezed, }) { - return _then(_$PersonImpl( + return _then(_self.copyWith( firstName: null == firstName - ? _value.firstName + ? _self.firstName : firstName // ignore: cast_nullable_to_non_nullable as String, lastName: null == lastName - ? _value.lastName + ? _self.lastName : lastName // ignore: cast_nullable_to_non_nullable as String, ignored: freezed == ignored - ? _value.ignored + ? _self.ignored : ignored // ignore: cast_nullable_to_non_nullable as int?, )); @@ -132,14 +100,12 @@ class __$$PersonImplCopyWithImpl<$Res> /// @nodoc @JsonSerializable(fieldRename: FieldRename.snake) -class _$PersonImpl implements _Person { - _$PersonImpl( +class _Person implements Person { + _Person( {required this.firstName, @JsonKey(name: 'LAST_NAME') required this.lastName, @JsonKey(includeFromJson: false, includeToJson: false) this.ignored}); - - factory _$PersonImpl.fromJson(Map json) => - _$$PersonImplFromJson(json); + factory _Person.fromJson(Map json) => _$PersonFromJson(json); @override final String firstName; @@ -150,16 +116,26 @@ class _$PersonImpl implements _Person { @JsonKey(includeFromJson: false, includeToJson: false) final int? ignored; + /// Create a copy of Person + /// with the given fields replaced by the non-null parameter values. @override - String toString() { - return 'Person(firstName: $firstName, lastName: $lastName, ignored: $ignored)'; + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + _$PersonCopyWith<_Person> get copyWith => + __$PersonCopyWithImpl<_Person>(this, _$identity); + + @override + Map toJson() { + return _$PersonToJson( + this, + ); } @override bool operator ==(Object other) { return identical(this, other) || (other.runtimeType == runtimeType && - other is _$PersonImpl && + other is _Person && (identical(other.firstName, firstName) || other.firstName == firstName) && (identical(other.lastName, lastName) || @@ -171,46 +147,55 @@ class _$PersonImpl implements _Person { @override int get hashCode => Object.hash(runtimeType, firstName, lastName, ignored); - /// Create a copy of Person - /// with the given fields replaced by the non-null parameter values. - @JsonKey(includeFromJson: false, includeToJson: false) - @override - @pragma('vm:prefer-inline') - _$$PersonImplCopyWith<_$PersonImpl> get copyWith => - __$$PersonImplCopyWithImpl<_$PersonImpl>(this, _$identity); - @override - Map toJson() { - return _$$PersonImplToJson( - this, - ); + String toString() { + return 'Person(firstName: $firstName, lastName: $lastName, ignored: $ignored)'; } } -abstract class _Person implements Person { - factory _Person( - {required final String firstName, - @JsonKey(name: 'LAST_NAME') required final String lastName, - @JsonKey(includeFromJson: false, includeToJson: false) - final int? ignored}) = _$PersonImpl; +/// @nodoc +abstract mixin class _$PersonCopyWith<$Res> implements $PersonCopyWith<$Res> { + factory _$PersonCopyWith(_Person value, $Res Function(_Person) _then) = + __$PersonCopyWithImpl; + @override + @useResult + $Res call( + {String firstName, + @JsonKey(name: 'LAST_NAME') String lastName, + @JsonKey(includeFromJson: false, includeToJson: false) int? ignored}); +} - factory _Person.fromJson(Map json) = _$PersonImpl.fromJson; +/// @nodoc +class __$PersonCopyWithImpl<$Res> implements _$PersonCopyWith<$Res> { + __$PersonCopyWithImpl(this._self, this._then); - @override - String get firstName; - @override - @JsonKey(name: 'LAST_NAME') - String get lastName; - @override - @JsonKey(includeFromJson: false, includeToJson: false) - int? get ignored; + final _Person _self; + final $Res Function(_Person) _then; /// Create a copy of Person /// with the given fields replaced by the non-null parameter values. @override - @JsonKey(includeFromJson: false, includeToJson: false) - _$$PersonImplCopyWith<_$PersonImpl> get copyWith => - throw _privateConstructorUsedError; + @pragma('vm:prefer-inline') + $Res call({ + Object? firstName = null, + Object? lastName = null, + Object? ignored = freezed, + }) { + return _then(_Person( + firstName: null == firstName + ? _self.firstName + : firstName // ignore: cast_nullable_to_non_nullable + as String, + lastName: null == lastName + ? _self.lastName + : lastName // ignore: cast_nullable_to_non_nullable + as String, + ignored: freezed == ignored + ? _self.ignored + : ignored // ignore: cast_nullable_to_non_nullable + as int?, + )); + } } PublicRedirected _$PublicRedirectedFromJson(Map json) { @@ -219,71 +204,53 @@ PublicRedirected _$PublicRedirectedFromJson(Map json) { /// @nodoc mixin _$PublicRedirected { - String get value => throw _privateConstructorUsedError; - - /// Serializes this PublicRedirected to a JSON map. - Map toJson() => throw _privateConstructorUsedError; + String get value; /// Create a copy of PublicRedirected /// with the given fields replaced by the non-null parameter values. @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') $PublicRedirectedCopyWith get copyWith => - throw _privateConstructorUsedError; -} + _$PublicRedirectedCopyWithImpl( + this as PublicRedirected, _$identity); -/// @nodoc -abstract class $PublicRedirectedCopyWith<$Res> { - factory $PublicRedirectedCopyWith( - PublicRedirected value, $Res Function(PublicRedirected) then) = - _$PublicRedirectedCopyWithImpl<$Res, PublicRedirected>; - @useResult - $Res call({String value}); -} + /// Serializes this PublicRedirected to a JSON map. + Map toJson(); -/// @nodoc -class _$PublicRedirectedCopyWithImpl<$Res, $Val extends PublicRedirected> - implements $PublicRedirectedCopyWith<$Res> { - _$PublicRedirectedCopyWithImpl(this._value, this._then); + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is PublicRedirected && + (identical(other.value, value) || other.value == value)); + } - // ignore: unused_field - final $Val _value; - // ignore: unused_field - final $Res Function($Val) _then; + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => Object.hash(runtimeType, value); - /// Create a copy of PublicRedirected - /// with the given fields replaced by the non-null parameter values. - @pragma('vm:prefer-inline') @override - $Res call({ - Object? value = null, - }) { - return _then(_value.copyWith( - value: null == value - ? _value.value - : value // ignore: cast_nullable_to_non_nullable - as String, - ) as $Val); + String toString() { + return 'PublicRedirected(value: $value)'; } } /// @nodoc -abstract class _$$PublicRedirected2ImplCopyWith<$Res> - implements $PublicRedirectedCopyWith<$Res> { - factory _$$PublicRedirected2ImplCopyWith(_$PublicRedirected2Impl value, - $Res Function(_$PublicRedirected2Impl) then) = - __$$PublicRedirected2ImplCopyWithImpl<$Res>; - @override +abstract mixin class $PublicRedirectedCopyWith<$Res> { + factory $PublicRedirectedCopyWith( + PublicRedirected value, $Res Function(PublicRedirected) _then) = + _$PublicRedirectedCopyWithImpl; @useResult $Res call({String value}); } /// @nodoc -class __$$PublicRedirected2ImplCopyWithImpl<$Res> - extends _$PublicRedirectedCopyWithImpl<$Res, _$PublicRedirected2Impl> - implements _$$PublicRedirected2ImplCopyWith<$Res> { - __$$PublicRedirected2ImplCopyWithImpl(_$PublicRedirected2Impl _value, - $Res Function(_$PublicRedirected2Impl) _then) - : super(_value, _then); +class _$PublicRedirectedCopyWithImpl<$Res> + implements $PublicRedirectedCopyWith<$Res> { + _$PublicRedirectedCopyWithImpl(this._self, this._then); + + final PublicRedirected _self; + final $Res Function(PublicRedirected) _then; /// Create a copy of PublicRedirected /// with the given fields replaced by the non-null parameter values. @@ -292,9 +259,9 @@ class __$$PublicRedirected2ImplCopyWithImpl<$Res> $Res call({ Object? value = null, }) { - return _then(_$PublicRedirected2Impl( + return _then(_self.copyWith( value: null == value - ? _value.value + ? _self.value : value // ignore: cast_nullable_to_non_nullable as String, )); @@ -303,25 +270,34 @@ class __$$PublicRedirected2ImplCopyWithImpl<$Res> /// @nodoc @JsonSerializable() -class _$PublicRedirected2Impl implements PublicRedirected2 { - _$PublicRedirected2Impl({required this.value}); - - factory _$PublicRedirected2Impl.fromJson(Map json) => - _$$PublicRedirected2ImplFromJson(json); +class PublicRedirected2 implements PublicRedirected { + PublicRedirected2({required this.value}); + factory PublicRedirected2.fromJson(Map json) => + _$PublicRedirected2FromJson(json); @override final String value; + /// Create a copy of PublicRedirected + /// with the given fields replaced by the non-null parameter values. @override - String toString() { - return 'PublicRedirected(value: $value)'; + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $PublicRedirected2CopyWith get copyWith => + _$PublicRedirected2CopyWithImpl(this, _$identity); + + @override + Map toJson() { + return _$PublicRedirected2ToJson( + this, + ); } @override bool operator ==(Object other) { return identical(this, other) || (other.runtimeType == runtimeType && - other is _$PublicRedirected2Impl && + other is PublicRedirected2 && (identical(other.value, value) || other.value == value)); } @@ -329,37 +305,45 @@ class _$PublicRedirected2Impl implements PublicRedirected2 { @override int get hashCode => Object.hash(runtimeType, value); - /// Create a copy of PublicRedirected - /// with the given fields replaced by the non-null parameter values. - @JsonKey(includeFromJson: false, includeToJson: false) - @override - @pragma('vm:prefer-inline') - _$$PublicRedirected2ImplCopyWith<_$PublicRedirected2Impl> get copyWith => - __$$PublicRedirected2ImplCopyWithImpl<_$PublicRedirected2Impl>( - this, _$identity); - @override - Map toJson() { - return _$$PublicRedirected2ImplToJson( - this, - ); + String toString() { + return 'PublicRedirected(value: $value)'; } } -abstract class PublicRedirected2 implements PublicRedirected { - factory PublicRedirected2({required final String value}) = - _$PublicRedirected2Impl; +/// @nodoc +abstract mixin class $PublicRedirected2CopyWith<$Res> + implements $PublicRedirectedCopyWith<$Res> { + factory $PublicRedirected2CopyWith( + PublicRedirected2 value, $Res Function(PublicRedirected2) _then) = + _$PublicRedirected2CopyWithImpl; + @override + @useResult + $Res call({String value}); +} - factory PublicRedirected2.fromJson(Map json) = - _$PublicRedirected2Impl.fromJson; +/// @nodoc +class _$PublicRedirected2CopyWithImpl<$Res> + implements $PublicRedirected2CopyWith<$Res> { + _$PublicRedirected2CopyWithImpl(this._self, this._then); - @override - String get value; + final PublicRedirected2 _self; + final $Res Function(PublicRedirected2) _then; /// Create a copy of PublicRedirected /// with the given fields replaced by the non-null parameter values. @override - @JsonKey(includeFromJson: false, includeToJson: false) - _$$PublicRedirected2ImplCopyWith<_$PublicRedirected2Impl> get copyWith => - throw _privateConstructorUsedError; + @pragma('vm:prefer-inline') + $Res call({ + Object? value = null, + }) { + return _then(PublicRedirected2( + value: null == value + ? _self.value + : value // ignore: cast_nullable_to_non_nullable + as String, + )); + } } + +// dart format on diff --git a/packages/cloud_firestore_odm/example/lib/integration/freezed.g.dart b/packages/cloud_firestore_odm/example/lib/integration/freezed.g.dart index 9f9482d..8cbddce 100644 --- a/packages/cloud_firestore_odm/example/lib/integration/freezed.g.dart +++ b/packages/cloud_firestore_odm/example/lib/integration/freezed.g.dart @@ -242,9 +242,9 @@ class _$PersonDocumentReference final json = { ...model.toJson(), if (firstNameFieldValue != null) - _$$PersonImplFieldMap['firstName']!: firstNameFieldValue, + _$PersonFieldMap['firstName']!: firstNameFieldValue, if (lastNameFieldValue != null) - _$$PersonImplFieldMap['lastName']!: lastNameFieldValue, + _$PersonFieldMap['lastName']!: lastNameFieldValue, }; final castedReference = reference.withConverter>( @@ -264,9 +264,9 @@ class _$PersonDocumentReference final json = { ...model.toJson(), if (firstNameFieldValue != null) - _$$PersonImplFieldMap['firstName']!: firstNameFieldValue, + _$PersonFieldMap['firstName']!: firstNameFieldValue, if (lastNameFieldValue != null) - _$$PersonImplFieldMap['lastName']!: lastNameFieldValue, + _$PersonFieldMap['lastName']!: lastNameFieldValue, }; transaction.set(reference, json, options); @@ -282,9 +282,9 @@ class _$PersonDocumentReference final json = { ...model.toJson(), if (firstNameFieldValue != null) - _$$PersonImplFieldMap['firstName']!: firstNameFieldValue, + _$PersonFieldMap['firstName']!: firstNameFieldValue, if (lastNameFieldValue != null) - _$$PersonImplFieldMap['lastName']!: lastNameFieldValue, + _$PersonFieldMap['lastName']!: lastNameFieldValue, }; batch.set(reference, json, options); @@ -306,15 +306,15 @@ class _$PersonDocumentReference ); final json = { if (firstName != _sentinel) - _$$PersonImplFieldMap['firstName']!: - _$$PersonImplPerFieldToJson.firstName(firstName as String), + _$PersonFieldMap['firstName']!: + _$PersonPerFieldToJson.firstName(firstName as String), if (firstNameFieldValue != null) - _$$PersonImplFieldMap['firstName']!: firstNameFieldValue, + _$PersonFieldMap['firstName']!: firstNameFieldValue, if (lastName != _sentinel) - _$$PersonImplFieldMap['lastName']!: - _$$PersonImplPerFieldToJson.lastName(lastName as String), + _$PersonFieldMap['lastName']!: + _$PersonPerFieldToJson.lastName(lastName as String), if (lastNameFieldValue != null) - _$$PersonImplFieldMap['lastName']!: lastNameFieldValue, + _$PersonFieldMap['lastName']!: lastNameFieldValue, }; return reference.update(json); @@ -337,15 +337,15 @@ class _$PersonDocumentReference ); final json = { if (firstName != _sentinel) - _$$PersonImplFieldMap['firstName']!: - _$$PersonImplPerFieldToJson.firstName(firstName as String), + _$PersonFieldMap['firstName']!: + _$PersonPerFieldToJson.firstName(firstName as String), if (firstNameFieldValue != null) - _$$PersonImplFieldMap['firstName']!: firstNameFieldValue, + _$PersonFieldMap['firstName']!: firstNameFieldValue, if (lastName != _sentinel) - _$$PersonImplFieldMap['lastName']!: - _$$PersonImplPerFieldToJson.lastName(lastName as String), + _$PersonFieldMap['lastName']!: + _$PersonPerFieldToJson.lastName(lastName as String), if (lastNameFieldValue != null) - _$$PersonImplFieldMap['lastName']!: lastNameFieldValue, + _$PersonFieldMap['lastName']!: lastNameFieldValue, }; transaction.update(reference, json); @@ -368,15 +368,15 @@ class _$PersonDocumentReference ); final json = { if (firstName != _sentinel) - _$$PersonImplFieldMap['firstName']!: - _$$PersonImplPerFieldToJson.firstName(firstName as String), + _$PersonFieldMap['firstName']!: + _$PersonPerFieldToJson.firstName(firstName as String), if (firstNameFieldValue != null) - _$$PersonImplFieldMap['firstName']!: firstNameFieldValue, + _$PersonFieldMap['firstName']!: firstNameFieldValue, if (lastName != _sentinel) - _$$PersonImplFieldMap['lastName']!: - _$$PersonImplPerFieldToJson.lastName(lastName as String), + _$PersonFieldMap['lastName']!: + _$PersonPerFieldToJson.lastName(lastName as String), if (lastNameFieldValue != null) - _$$PersonImplFieldMap['lastName']!: lastNameFieldValue, + _$PersonFieldMap['lastName']!: lastNameFieldValue, }; batch.update(reference, json); @@ -665,30 +665,27 @@ class _$PersonQuery extends QueryReference return _$PersonQuery( _collection, $referenceWithoutCursor: $referenceWithoutCursor.where( - _$$PersonImplFieldMap['firstName']!, + _$PersonFieldMap['firstName']!, isEqualTo: isEqualTo != _sentinel - ? _$$PersonImplPerFieldToJson.firstName(isEqualTo as String) + ? _$PersonPerFieldToJson.firstName(isEqualTo as String) : null, isNotEqualTo: isNotEqualTo != _sentinel - ? _$$PersonImplPerFieldToJson.firstName(isNotEqualTo as String) + ? _$PersonPerFieldToJson.firstName(isNotEqualTo as String) : null, isLessThan: isLessThan != null - ? _$$PersonImplPerFieldToJson.firstName(isLessThan as String) + ? _$PersonPerFieldToJson.firstName(isLessThan as String) : null, isLessThanOrEqualTo: isLessThanOrEqualTo != null - ? _$$PersonImplPerFieldToJson - .firstName(isLessThanOrEqualTo as String) + ? _$PersonPerFieldToJson.firstName(isLessThanOrEqualTo as String) : null, isGreaterThan: isGreaterThan != null - ? _$$PersonImplPerFieldToJson.firstName(isGreaterThan as String) + ? _$PersonPerFieldToJson.firstName(isGreaterThan as String) : null, isGreaterThanOrEqualTo: isGreaterThanOrEqualTo != null - ? _$$PersonImplPerFieldToJson - .firstName(isGreaterThanOrEqualTo as String) + ? _$PersonPerFieldToJson.firstName(isGreaterThanOrEqualTo as String) : null, - whereIn: whereIn?.map((e) => _$$PersonImplPerFieldToJson.firstName(e)), - whereNotIn: - whereNotIn?.map((e) => _$$PersonImplPerFieldToJson.firstName(e)), + whereIn: whereIn?.map((e) => _$PersonPerFieldToJson.firstName(e)), + whereNotIn: whereNotIn?.map((e) => _$PersonPerFieldToJson.firstName(e)), isNull: isNull ?? (isEqualTo == null ? false : null) ?? (isNotEqualTo == null ? true : null), @@ -712,30 +709,27 @@ class _$PersonQuery extends QueryReference return _$PersonQuery( _collection, $referenceWithoutCursor: $referenceWithoutCursor.where( - _$$PersonImplFieldMap['lastName']!, + _$PersonFieldMap['lastName']!, isEqualTo: isEqualTo != _sentinel - ? _$$PersonImplPerFieldToJson.lastName(isEqualTo as String) + ? _$PersonPerFieldToJson.lastName(isEqualTo as String) : null, isNotEqualTo: isNotEqualTo != _sentinel - ? _$$PersonImplPerFieldToJson.lastName(isNotEqualTo as String) + ? _$PersonPerFieldToJson.lastName(isNotEqualTo as String) : null, isLessThan: isLessThan != null - ? _$$PersonImplPerFieldToJson.lastName(isLessThan as String) + ? _$PersonPerFieldToJson.lastName(isLessThan as String) : null, isLessThanOrEqualTo: isLessThanOrEqualTo != null - ? _$$PersonImplPerFieldToJson - .lastName(isLessThanOrEqualTo as String) + ? _$PersonPerFieldToJson.lastName(isLessThanOrEqualTo as String) : null, isGreaterThan: isGreaterThan != null - ? _$$PersonImplPerFieldToJson.lastName(isGreaterThan as String) + ? _$PersonPerFieldToJson.lastName(isGreaterThan as String) : null, isGreaterThanOrEqualTo: isGreaterThanOrEqualTo != null - ? _$$PersonImplPerFieldToJson - .lastName(isGreaterThanOrEqualTo as String) + ? _$PersonPerFieldToJson.lastName(isGreaterThanOrEqualTo as String) : null, - whereIn: whereIn?.map((e) => _$$PersonImplPerFieldToJson.lastName(e)), - whereNotIn: - whereNotIn?.map((e) => _$$PersonImplPerFieldToJson.lastName(e)), + whereIn: whereIn?.map((e) => _$PersonPerFieldToJson.lastName(e)), + whereNotIn: whereNotIn?.map((e) => _$PersonPerFieldToJson.lastName(e)), isNull: isNull ?? (isEqualTo == null ? false : null) ?? (isNotEqualTo == null ? true : null), @@ -904,7 +898,7 @@ class _$PersonQuery extends QueryReference PersonDocumentSnapshot? startAfterDocument, }) { final query = $referenceWithoutCursor - .orderBy(_$$PersonImplFieldMap['firstName']!, descending: descending); + .orderBy(_$PersonFieldMap['firstName']!, descending: descending); var queryCursor = $queryCursor; if (startAtDocument != null) { @@ -976,8 +970,8 @@ class _$PersonQuery extends QueryReference PersonDocumentSnapshot? endBeforeDocument, PersonDocumentSnapshot? startAfterDocument, }) { - final query = $referenceWithoutCursor - .orderBy(_$$PersonImplFieldMap['lastName']!, descending: descending); + final query = $referenceWithoutCursor.orderBy(_$PersonFieldMap['lastName']!, + descending: descending); var queryCursor = $queryCursor; if (startAtDocument != null) { @@ -1350,7 +1344,7 @@ class _$PublicRedirectedDocumentReference extends FirestoreDocumentReference< final json = { ...model.toJson(), if (valueFieldValue != null) - _$$PublicRedirected2ImplFieldMap['value']!: valueFieldValue, + _$PublicRedirected2FieldMap['value']!: valueFieldValue, }; final castedReference = reference.withConverter>( @@ -1369,7 +1363,7 @@ class _$PublicRedirectedDocumentReference extends FirestoreDocumentReference< final json = { ...model.toJson(), if (valueFieldValue != null) - _$$PublicRedirected2ImplFieldMap['value']!: valueFieldValue, + _$PublicRedirected2FieldMap['value']!: valueFieldValue, }; transaction.set(reference, json, options); @@ -1384,7 +1378,7 @@ class _$PublicRedirectedDocumentReference extends FirestoreDocumentReference< final json = { ...model.toJson(), if (valueFieldValue != null) - _$$PublicRedirected2ImplFieldMap['value']!: valueFieldValue, + _$PublicRedirected2FieldMap['value']!: valueFieldValue, }; batch.set(reference, json, options); @@ -1400,10 +1394,10 @@ class _$PublicRedirectedDocumentReference extends FirestoreDocumentReference< ); final json = { if (value != _sentinel) - _$$PublicRedirected2ImplFieldMap['value']!: - _$$PublicRedirected2ImplPerFieldToJson.value(value as String), + _$PublicRedirected2FieldMap['value']!: + _$PublicRedirected2PerFieldToJson.value(value as String), if (valueFieldValue != null) - _$$PublicRedirected2ImplFieldMap['value']!: valueFieldValue, + _$PublicRedirected2FieldMap['value']!: valueFieldValue, }; return reference.update(json); @@ -1420,10 +1414,10 @@ class _$PublicRedirectedDocumentReference extends FirestoreDocumentReference< ); final json = { if (value != _sentinel) - _$$PublicRedirected2ImplFieldMap['value']!: - _$$PublicRedirected2ImplPerFieldToJson.value(value as String), + _$PublicRedirected2FieldMap['value']!: + _$PublicRedirected2PerFieldToJson.value(value as String), if (valueFieldValue != null) - _$$PublicRedirected2ImplFieldMap['value']!: valueFieldValue, + _$PublicRedirected2FieldMap['value']!: valueFieldValue, }; transaction.update(reference, json); @@ -1440,10 +1434,10 @@ class _$PublicRedirectedDocumentReference extends FirestoreDocumentReference< ); final json = { if (value != _sentinel) - _$$PublicRedirected2ImplFieldMap['value']!: - _$$PublicRedirected2ImplPerFieldToJson.value(value as String), + _$PublicRedirected2FieldMap['value']!: + _$PublicRedirected2PerFieldToJson.value(value as String), if (valueFieldValue != null) - _$$PublicRedirected2ImplFieldMap['value']!: valueFieldValue, + _$PublicRedirected2FieldMap['value']!: valueFieldValue, }; batch.update(reference, json); @@ -1713,33 +1707,31 @@ class _$PublicRedirectedQuery return _$PublicRedirectedQuery( _collection, $referenceWithoutCursor: $referenceWithoutCursor.where( - _$$PublicRedirected2ImplFieldMap['value']!, + _$PublicRedirected2FieldMap['value']!, isEqualTo: isEqualTo != _sentinel - ? _$$PublicRedirected2ImplPerFieldToJson.value(isEqualTo as String) + ? _$PublicRedirected2PerFieldToJson.value(isEqualTo as String) : null, isNotEqualTo: isNotEqualTo != _sentinel - ? _$$PublicRedirected2ImplPerFieldToJson - .value(isNotEqualTo as String) + ? _$PublicRedirected2PerFieldToJson.value(isNotEqualTo as String) : null, isLessThan: isLessThan != null - ? _$$PublicRedirected2ImplPerFieldToJson.value(isLessThan as String) + ? _$PublicRedirected2PerFieldToJson.value(isLessThan as String) : null, isLessThanOrEqualTo: isLessThanOrEqualTo != null - ? _$$PublicRedirected2ImplPerFieldToJson + ? _$PublicRedirected2PerFieldToJson .value(isLessThanOrEqualTo as String) : null, isGreaterThan: isGreaterThan != null - ? _$$PublicRedirected2ImplPerFieldToJson - .value(isGreaterThan as String) + ? _$PublicRedirected2PerFieldToJson.value(isGreaterThan as String) : null, isGreaterThanOrEqualTo: isGreaterThanOrEqualTo != null - ? _$$PublicRedirected2ImplPerFieldToJson + ? _$PublicRedirected2PerFieldToJson .value(isGreaterThanOrEqualTo as String) : null, - whereIn: whereIn - ?.map((e) => _$$PublicRedirected2ImplPerFieldToJson.value(e)), - whereNotIn: whereNotIn - ?.map((e) => _$$PublicRedirected2ImplPerFieldToJson.value(e)), + whereIn: + whereIn?.map((e) => _$PublicRedirected2PerFieldToJson.value(e)), + whereNotIn: + whereNotIn?.map((e) => _$PublicRedirected2PerFieldToJson.value(e)), isNull: isNull ?? (isEqualTo == null ? false : null) ?? (isNotEqualTo == null ? true : null), @@ -1907,9 +1899,8 @@ class _$PublicRedirectedQuery PublicRedirectedDocumentSnapshot? endBeforeDocument, PublicRedirectedDocumentSnapshot? startAfterDocument, }) { - final query = $referenceWithoutCursor.orderBy( - _$$PublicRedirected2ImplFieldMap['value']!, - descending: descending); + final query = $referenceWithoutCursor + .orderBy(_$PublicRedirected2FieldMap['value']!, descending: descending); var queryCursor = $queryCursor; if (startAtDocument != null) { @@ -2072,48 +2063,45 @@ class PublicRedirectedQueryDocumentSnapshot // JsonSerializableGenerator // ************************************************************************** -_$PersonImpl _$$PersonImplFromJson(Map json) => _$PersonImpl( +_Person _$PersonFromJson(Map json) => _Person( firstName: json['first_name'] as String, lastName: json['LAST_NAME'] as String, ); -const _$$PersonImplFieldMap = { +const _$PersonFieldMap = { 'firstName': 'first_name', 'lastName': 'LAST_NAME', }; // ignore: unused_element -abstract class _$$PersonImplPerFieldToJson { +abstract class _$PersonPerFieldToJson { // ignore: unused_element static Object? firstName(String instance) => instance; // ignore: unused_element static Object? lastName(String instance) => instance; } -Map _$$PersonImplToJson(_$PersonImpl instance) => - { +Map _$PersonToJson(_Person instance) => { 'first_name': instance.firstName, 'LAST_NAME': instance.lastName, }; -_$PublicRedirected2Impl _$$PublicRedirected2ImplFromJson( - Map json) => - _$PublicRedirected2Impl( +PublicRedirected2 _$PublicRedirected2FromJson(Map json) => + PublicRedirected2( value: json['value'] as String, ); -const _$$PublicRedirected2ImplFieldMap = { +const _$PublicRedirected2FieldMap = { 'value': 'value', }; // ignore: unused_element -abstract class _$$PublicRedirected2ImplPerFieldToJson { +abstract class _$PublicRedirected2PerFieldToJson { // ignore: unused_element static Object? value(String instance) => instance; } -Map _$$PublicRedirected2ImplToJson( - _$PublicRedirected2Impl instance) => +Map _$PublicRedirected2ToJson(PublicRedirected2 instance) => { 'value': instance.value, }; diff --git a/packages/cloud_firestore_odm/example/pubspec.yaml b/packages/cloud_firestore_odm/example/pubspec.yaml index f7354cb..a6e669f 100644 --- a/packages/cloud_firestore_odm/example/pubspec.yaml +++ b/packages/cloud_firestore_odm/example/pubspec.yaml @@ -2,16 +2,16 @@ name: cloud_firestore_odm_example publish_to: none environment: - sdk: '>=2.18.0 <4.0.0' + sdk: ">=3.0.0 <4.0.0" dependencies: - cloud_firestore: ^5.0.0 - cloud_firestore_odm: ^1.0.0-dev.85 + cloud_firestore: ^5.6.5 + cloud_firestore_odm: ^1.1.0 firebase_core: ^3.0.0 flutter: sdk: flutter - freezed_annotation: ^2.2.0 - json_annotation: ^4.8.1 + freezed_annotation: ^3.0.0 + json_annotation: ^4.9.0 meta: ^1.12.0 dev_dependencies: @@ -22,11 +22,11 @@ dev_dependencies: path: ../../cloud_firestore_odm_generator/cloud_firestore_odm_generator_integration_test flutter_test: sdk: flutter - freezed: ^2.3.2 + freezed: ^3.0.0 http: ^1.0.0 integration_test: sdk: flutter - json_serializable: ^6.6.1 + json_serializable: ^6.7.0 mockito: ^5.0.0 dependency_overrides: diff --git a/packages/cloud_firestore_odm/pubspec.yaml b/packages/cloud_firestore_odm/pubspec.yaml index 1873718..84a2941 100644 --- a/packages/cloud_firestore_odm/pubspec.yaml +++ b/packages/cloud_firestore_odm/pubspec.yaml @@ -2,21 +2,22 @@ name: cloud_firestore_odm description: An ODM for Firebase Cloud Firestore (cloud_firestore). homepage: https://github.com/firebaseextended/firestoreodm-flutter repository: https://github.com/firebaseextended/firestoreodm-flutter -version: 1.0.0-dev.88 +version: 1.1.0 false_secrets: - example/** environment: - sdk: '>=2.18.0 <4.0.0' + sdk: ">=3.0.0 <4.0.0" dependencies: - cloud_firestore: ^5.0.0 + cloud_firestore: ^5.0.2 flutter: sdk: flutter - json_annotation: ^4.8.1 + json_annotation: ^4.9.0 meta: ^1.12.0 dev_dependencies: flutter_test: sdk: flutter + test: ^1.25.1 diff --git a/packages/cloud_firestore_odm_generator/CHANGELOG.md b/packages/cloud_firestore_odm_generator/CHANGELOG.md index 28119ba..34cd24c 100644 --- a/packages/cloud_firestore_odm_generator/CHANGELOG.md +++ b/packages/cloud_firestore_odm_generator/CHANGELOG.md @@ -1,3 +1,9 @@ +## 1.1.0 + +- **FIX**: Resolve compatibility issues with Freezed 3.0.0 and above +- **FEAT**: Support analyzer: ^7.0.0 and source_gen: ^2.0.0 +- **CHORE**: Update dependencies to latest versions + ## 1.0.0-dev.90 - 2025-02-23 - Ignore static getters on annotated classes (thanks to @Rexios80) diff --git a/packages/cloud_firestore_odm_generator/cloud_firestore_odm_generator_integration_test/lib/freezed.dart b/packages/cloud_firestore_odm_generator/cloud_firestore_odm_generator_integration_test/lib/freezed.dart index 4453f8b..e8af1d2 100644 --- a/packages/cloud_firestore_odm_generator/cloud_firestore_odm_generator_integration_test/lib/freezed.dart +++ b/packages/cloud_firestore_odm_generator/cloud_firestore_odm_generator_integration_test/lib/freezed.dart @@ -13,7 +13,7 @@ part 'freezed.g.dart'; @Collection('freezed-test') @freezed -class Person with _$Person { +abstract class Person with _$Person { @JsonSerializable(fieldRename: FieldRename.snake) factory Person({ required String firstName, @@ -28,9 +28,24 @@ final personRef = PersonCollectionReference(); @Collection('freezed-test') @freezed -class PublicRedirected with _$PublicRedirected { +abstract class PublicRedirected with _$PublicRedirected { factory PublicRedirected({required String value}) = PublicRedirected2; factory PublicRedirected.fromJson(Map json) => _$PublicRedirectedFromJson(json); } + +/// Freezed 3.x mixed mode +/// +/// Simple classes +@Collection('freezed-test') +@freezed +@JsonSerializable() +class SimpleFreezed with _$SimpleFreezed { + SimpleFreezed({required this.a}); + final int a; + + factory SimpleFreezed.fromJson(Map json) => + _$SimpleFreezedFromJson(json); + Map toJson() => _$SimpleFreezedToJson(this); +} diff --git a/packages/cloud_firestore_odm_generator/cloud_firestore_odm_generator_integration_test/lib/freezed.freezed.dart b/packages/cloud_firestore_odm_generator/cloud_firestore_odm_generator_integration_test/lib/freezed.freezed.dart index 5c1d22c..661f349 100644 --- a/packages/cloud_firestore_odm_generator/cloud_firestore_odm_generator_integration_test/lib/freezed.freezed.dart +++ b/packages/cloud_firestore_odm_generator/cloud_firestore_odm_generator_integration_test/lib/freezed.freezed.dart @@ -1,3 +1,4 @@ +// dart format width=80 // coverage:ignore-file // GENERATED CODE - DO NOT MODIFY BY HAND // ignore_for_file: type=lint @@ -9,85 +10,53 @@ part of 'freezed.dart'; // FreezedGenerator // ************************************************************************** +// dart format off T _$identity(T value) => value; -final _privateConstructorUsedError = UnsupportedError( - 'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models'); - -Person _$PersonFromJson(Map json) { - return _Person.fromJson(json); -} - /// @nodoc mixin _$Person { - String get firstName => throw _privateConstructorUsedError; + String get firstName; @JsonKey(name: 'LAST_NAME') - String get lastName => throw _privateConstructorUsedError; + String get lastName; @JsonKey(includeFromJson: false, includeToJson: false) - int? get ignored => throw _privateConstructorUsedError; - - /// Serializes this Person to a JSON map. - Map toJson() => throw _privateConstructorUsedError; + int? get ignored; /// Create a copy of Person /// with the given fields replaced by the non-null parameter values. @JsonKey(includeFromJson: false, includeToJson: false) - $PersonCopyWith get copyWith => throw _privateConstructorUsedError; -} + @pragma('vm:prefer-inline') + $PersonCopyWith get copyWith => + _$PersonCopyWithImpl(this as Person, _$identity); -/// @nodoc -abstract class $PersonCopyWith<$Res> { - factory $PersonCopyWith(Person value, $Res Function(Person) then) = - _$PersonCopyWithImpl<$Res, Person>; - @useResult - $Res call( - {String firstName, - @JsonKey(name: 'LAST_NAME') String lastName, - @JsonKey(includeFromJson: false, includeToJson: false) int? ignored}); -} + /// Serializes this Person to a JSON map. + Map toJson(); -/// @nodoc -class _$PersonCopyWithImpl<$Res, $Val extends Person> - implements $PersonCopyWith<$Res> { - _$PersonCopyWithImpl(this._value, this._then); + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is Person && + (identical(other.firstName, firstName) || + other.firstName == firstName) && + (identical(other.lastName, lastName) || + other.lastName == lastName) && + (identical(other.ignored, ignored) || other.ignored == ignored)); + } - // ignore: unused_field - final $Val _value; - // ignore: unused_field - final $Res Function($Val) _then; + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => Object.hash(runtimeType, firstName, lastName, ignored); - /// Create a copy of Person - /// with the given fields replaced by the non-null parameter values. - @pragma('vm:prefer-inline') @override - $Res call({ - Object? firstName = null, - Object? lastName = null, - Object? ignored = freezed, - }) { - return _then(_value.copyWith( - firstName: null == firstName - ? _value.firstName - : firstName // ignore: cast_nullable_to_non_nullable - as String, - lastName: null == lastName - ? _value.lastName - : lastName // ignore: cast_nullable_to_non_nullable - as String, - ignored: freezed == ignored - ? _value.ignored - : ignored // ignore: cast_nullable_to_non_nullable - as int?, - ) as $Val); + String toString() { + return 'Person(firstName: $firstName, lastName: $lastName, ignored: $ignored)'; } } /// @nodoc -abstract class _$$PersonImplCopyWith<$Res> implements $PersonCopyWith<$Res> { - factory _$$PersonImplCopyWith( - _$PersonImpl value, $Res Function(_$PersonImpl) then) = - __$$PersonImplCopyWithImpl<$Res>; - @override +abstract mixin class $PersonCopyWith<$Res> { + factory $PersonCopyWith(Person value, $Res Function(Person) _then) = + _$PersonCopyWithImpl; @useResult $Res call( {String firstName, @@ -96,12 +65,11 @@ abstract class _$$PersonImplCopyWith<$Res> implements $PersonCopyWith<$Res> { } /// @nodoc -class __$$PersonImplCopyWithImpl<$Res> - extends _$PersonCopyWithImpl<$Res, _$PersonImpl> - implements _$$PersonImplCopyWith<$Res> { - __$$PersonImplCopyWithImpl( - _$PersonImpl _value, $Res Function(_$PersonImpl) _then) - : super(_value, _then); +class _$PersonCopyWithImpl<$Res> implements $PersonCopyWith<$Res> { + _$PersonCopyWithImpl(this._self, this._then); + + final Person _self; + final $Res Function(Person) _then; /// Create a copy of Person /// with the given fields replaced by the non-null parameter values. @@ -112,17 +80,17 @@ class __$$PersonImplCopyWithImpl<$Res> Object? lastName = null, Object? ignored = freezed, }) { - return _then(_$PersonImpl( + return _then(_self.copyWith( firstName: null == firstName - ? _value.firstName + ? _self.firstName : firstName // ignore: cast_nullable_to_non_nullable as String, lastName: null == lastName - ? _value.lastName + ? _self.lastName : lastName // ignore: cast_nullable_to_non_nullable as String, ignored: freezed == ignored - ? _value.ignored + ? _self.ignored : ignored // ignore: cast_nullable_to_non_nullable as int?, )); @@ -132,14 +100,12 @@ class __$$PersonImplCopyWithImpl<$Res> /// @nodoc @JsonSerializable(fieldRename: FieldRename.snake) -class _$PersonImpl implements _Person { - _$PersonImpl( +class _Person implements Person { + _Person( {required this.firstName, @JsonKey(name: 'LAST_NAME') required this.lastName, @JsonKey(includeFromJson: false, includeToJson: false) this.ignored}); - - factory _$PersonImpl.fromJson(Map json) => - _$$PersonImplFromJson(json); + factory _Person.fromJson(Map json) => _$PersonFromJson(json); @override final String firstName; @@ -150,16 +116,26 @@ class _$PersonImpl implements _Person { @JsonKey(includeFromJson: false, includeToJson: false) final int? ignored; + /// Create a copy of Person + /// with the given fields replaced by the non-null parameter values. @override - String toString() { - return 'Person(firstName: $firstName, lastName: $lastName, ignored: $ignored)'; + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + _$PersonCopyWith<_Person> get copyWith => + __$PersonCopyWithImpl<_Person>(this, _$identity); + + @override + Map toJson() { + return _$PersonToJson( + this, + ); } @override bool operator ==(Object other) { return identical(this, other) || (other.runtimeType == runtimeType && - other is _$PersonImpl && + other is _Person && (identical(other.firstName, firstName) || other.firstName == firstName) && (identical(other.lastName, lastName) || @@ -171,46 +147,55 @@ class _$PersonImpl implements _Person { @override int get hashCode => Object.hash(runtimeType, firstName, lastName, ignored); - /// Create a copy of Person - /// with the given fields replaced by the non-null parameter values. - @JsonKey(includeFromJson: false, includeToJson: false) - @override - @pragma('vm:prefer-inline') - _$$PersonImplCopyWith<_$PersonImpl> get copyWith => - __$$PersonImplCopyWithImpl<_$PersonImpl>(this, _$identity); - @override - Map toJson() { - return _$$PersonImplToJson( - this, - ); + String toString() { + return 'Person(firstName: $firstName, lastName: $lastName, ignored: $ignored)'; } } -abstract class _Person implements Person { - factory _Person( - {required final String firstName, - @JsonKey(name: 'LAST_NAME') required final String lastName, - @JsonKey(includeFromJson: false, includeToJson: false) - final int? ignored}) = _$PersonImpl; +/// @nodoc +abstract mixin class _$PersonCopyWith<$Res> implements $PersonCopyWith<$Res> { + factory _$PersonCopyWith(_Person value, $Res Function(_Person) _then) = + __$PersonCopyWithImpl; + @override + @useResult + $Res call( + {String firstName, + @JsonKey(name: 'LAST_NAME') String lastName, + @JsonKey(includeFromJson: false, includeToJson: false) int? ignored}); +} - factory _Person.fromJson(Map json) = _$PersonImpl.fromJson; +/// @nodoc +class __$PersonCopyWithImpl<$Res> implements _$PersonCopyWith<$Res> { + __$PersonCopyWithImpl(this._self, this._then); - @override - String get firstName; - @override - @JsonKey(name: 'LAST_NAME') - String get lastName; - @override - @JsonKey(includeFromJson: false, includeToJson: false) - int? get ignored; + final _Person _self; + final $Res Function(_Person) _then; /// Create a copy of Person /// with the given fields replaced by the non-null parameter values. @override - @JsonKey(includeFromJson: false, includeToJson: false) - _$$PersonImplCopyWith<_$PersonImpl> get copyWith => - throw _privateConstructorUsedError; + @pragma('vm:prefer-inline') + $Res call({ + Object? firstName = null, + Object? lastName = null, + Object? ignored = freezed, + }) { + return _then(_Person( + firstName: null == firstName + ? _self.firstName + : firstName // ignore: cast_nullable_to_non_nullable + as String, + lastName: null == lastName + ? _self.lastName + : lastName // ignore: cast_nullable_to_non_nullable + as String, + ignored: freezed == ignored + ? _self.ignored + : ignored // ignore: cast_nullable_to_non_nullable + as int?, + )); + } } PublicRedirected _$PublicRedirectedFromJson(Map json) { @@ -219,36 +204,53 @@ PublicRedirected _$PublicRedirectedFromJson(Map json) { /// @nodoc mixin _$PublicRedirected { - String get value => throw _privateConstructorUsedError; - - /// Serializes this PublicRedirected to a JSON map. - Map toJson() => throw _privateConstructorUsedError; + String get value; /// Create a copy of PublicRedirected /// with the given fields replaced by the non-null parameter values. @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') $PublicRedirectedCopyWith get copyWith => - throw _privateConstructorUsedError; + _$PublicRedirectedCopyWithImpl( + this as PublicRedirected, _$identity); + + /// Serializes this PublicRedirected to a JSON map. + Map toJson(); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is PublicRedirected && + (identical(other.value, value) || other.value == value)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => Object.hash(runtimeType, value); + + @override + String toString() { + return 'PublicRedirected(value: $value)'; + } } /// @nodoc -abstract class $PublicRedirectedCopyWith<$Res> { +abstract mixin class $PublicRedirectedCopyWith<$Res> { factory $PublicRedirectedCopyWith( - PublicRedirected value, $Res Function(PublicRedirected) then) = - _$PublicRedirectedCopyWithImpl<$Res, PublicRedirected>; + PublicRedirected value, $Res Function(PublicRedirected) _then) = + _$PublicRedirectedCopyWithImpl; @useResult $Res call({String value}); } /// @nodoc -class _$PublicRedirectedCopyWithImpl<$Res, $Val extends PublicRedirected> +class _$PublicRedirectedCopyWithImpl<$Res> implements $PublicRedirectedCopyWith<$Res> { - _$PublicRedirectedCopyWithImpl(this._value, this._then); + _$PublicRedirectedCopyWithImpl(this._self, this._then); - // ignore: unused_field - final $Val _value; - // ignore: unused_field - final $Res Function($Val) _then; + final PublicRedirected _self; + final $Res Function(PublicRedirected) _then; /// Create a copy of PublicRedirected /// with the given fields replaced by the non-null parameter values. @@ -257,44 +259,87 @@ class _$PublicRedirectedCopyWithImpl<$Res, $Val extends PublicRedirected> $Res call({ Object? value = null, }) { - return _then(_value.copyWith( + return _then(_self.copyWith( value: null == value - ? _value.value + ? _self.value : value // ignore: cast_nullable_to_non_nullable as String, - ) as $Val); + )); } } /// @nodoc -abstract class _$$PublicRedirected2ImplCopyWith<$Res> +@JsonSerializable() +class PublicRedirected2 implements PublicRedirected { + PublicRedirected2({required this.value}); + factory PublicRedirected2.fromJson(Map json) => + _$PublicRedirected2FromJson(json); + + @override + final String value; + + /// Create a copy of PublicRedirected + /// with the given fields replaced by the non-null parameter values. + @override + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $PublicRedirected2CopyWith get copyWith => + _$PublicRedirected2CopyWithImpl(this, _$identity); + + @override + Map toJson() { + return _$PublicRedirected2ToJson( + this, + ); + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is PublicRedirected2 && + (identical(other.value, value) || other.value == value)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => Object.hash(runtimeType, value); + + @override + String toString() { + return 'PublicRedirected(value: $value)'; + } +} + +/// @nodoc +abstract mixin class $PublicRedirected2CopyWith<$Res> implements $PublicRedirectedCopyWith<$Res> { - factory _$$PublicRedirected2ImplCopyWith(_$PublicRedirected2Impl value, - $Res Function(_$PublicRedirected2Impl) then) = - __$$PublicRedirected2ImplCopyWithImpl<$Res>; + factory $PublicRedirected2CopyWith( + PublicRedirected2 value, $Res Function(PublicRedirected2) _then) = + _$PublicRedirected2CopyWithImpl; @override @useResult $Res call({String value}); } /// @nodoc -class __$$PublicRedirected2ImplCopyWithImpl<$Res> - extends _$PublicRedirectedCopyWithImpl<$Res, _$PublicRedirected2Impl> - implements _$$PublicRedirected2ImplCopyWith<$Res> { - __$$PublicRedirected2ImplCopyWithImpl(_$PublicRedirected2Impl _value, - $Res Function(_$PublicRedirected2Impl) _then) - : super(_value, _then); +class _$PublicRedirected2CopyWithImpl<$Res> + implements $PublicRedirected2CopyWith<$Res> { + _$PublicRedirected2CopyWithImpl(this._self, this._then); + + final PublicRedirected2 _self; + final $Res Function(PublicRedirected2) _then; /// Create a copy of PublicRedirected /// with the given fields replaced by the non-null parameter values. - @pragma('vm:prefer-inline') @override + @pragma('vm:prefer-inline') $Res call({ Object? value = null, }) { - return _then(_$PublicRedirected2Impl( + return _then(PublicRedirected2( value: null == value - ? _value.value + ? _self.value : value // ignore: cast_nullable_to_non_nullable as String, )); @@ -302,64 +347,66 @@ class __$$PublicRedirected2ImplCopyWithImpl<$Res> } /// @nodoc -@JsonSerializable() -class _$PublicRedirected2Impl implements PublicRedirected2 { - _$PublicRedirected2Impl({required this.value}); +mixin _$SimpleFreezed { + int get a; - factory _$PublicRedirected2Impl.fromJson(Map json) => - _$$PublicRedirected2ImplFromJson(json); - - @override - final String value; - - @override - String toString() { - return 'PublicRedirected(value: $value)'; - } + /// Create a copy of SimpleFreezed + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $SimpleFreezedCopyWith get copyWith => + _$SimpleFreezedCopyWithImpl( + this as SimpleFreezed, _$identity); @override bool operator ==(Object other) { return identical(this, other) || (other.runtimeType == runtimeType && - other is _$PublicRedirected2Impl && - (identical(other.value, value) || other.value == value)); + other is SimpleFreezed && + (identical(other.a, a) || other.a == a)); } @JsonKey(includeFromJson: false, includeToJson: false) @override - int get hashCode => Object.hash(runtimeType, value); + int get hashCode => Object.hash(runtimeType, a); - /// Create a copy of PublicRedirected - /// with the given fields replaced by the non-null parameter values. - @JsonKey(includeFromJson: false, includeToJson: false) @override - @pragma('vm:prefer-inline') - _$$PublicRedirected2ImplCopyWith<_$PublicRedirected2Impl> get copyWith => - __$$PublicRedirected2ImplCopyWithImpl<_$PublicRedirected2Impl>( - this, _$identity); - - @override - Map toJson() { - return _$$PublicRedirected2ImplToJson( - this, - ); + String toString() { + return 'SimpleFreezed(a: $a)'; } } -abstract class PublicRedirected2 implements PublicRedirected { - factory PublicRedirected2({required final String value}) = - _$PublicRedirected2Impl; +/// @nodoc +abstract mixin class $SimpleFreezedCopyWith<$Res> { + factory $SimpleFreezedCopyWith( + SimpleFreezed value, $Res Function(SimpleFreezed) _then) = + _$SimpleFreezedCopyWithImpl; + @useResult + $Res call({int a}); +} - factory PublicRedirected2.fromJson(Map json) = - _$PublicRedirected2Impl.fromJson; +/// @nodoc +class _$SimpleFreezedCopyWithImpl<$Res> + implements $SimpleFreezedCopyWith<$Res> { + _$SimpleFreezedCopyWithImpl(this._self, this._then); - @override - String get value; + final SimpleFreezed _self; + final $Res Function(SimpleFreezed) _then; - /// Create a copy of PublicRedirected + /// Create a copy of SimpleFreezed /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') @override - @JsonKey(includeFromJson: false, includeToJson: false) - _$$PublicRedirected2ImplCopyWith<_$PublicRedirected2Impl> get copyWith => - throw _privateConstructorUsedError; + $Res call({ + Object? a = null, + }) { + return _then(SimpleFreezed( + a: null == a + ? _self.a + : a // ignore: cast_nullable_to_non_nullable + as int, + )); + } } + +// dart format on diff --git a/packages/cloud_firestore_odm_generator/cloud_firestore_odm_generator_integration_test/lib/freezed.g.dart b/packages/cloud_firestore_odm_generator/cloud_firestore_odm_generator_integration_test/lib/freezed.g.dart index 7ca05a2..206181b 100644 --- a/packages/cloud_firestore_odm_generator/cloud_firestore_odm_generator_integration_test/lib/freezed.g.dart +++ b/packages/cloud_firestore_odm_generator/cloud_firestore_odm_generator_integration_test/lib/freezed.g.dart @@ -240,9 +240,9 @@ class _$PersonDocumentReference final json = { ...model.toJson(), if (firstNameFieldValue != null) - _$$PersonImplFieldMap['firstName']!: firstNameFieldValue, + _$PersonFieldMap['firstName']!: firstNameFieldValue, if (lastNameFieldValue != null) - _$$PersonImplFieldMap['lastName']!: lastNameFieldValue, + _$PersonFieldMap['lastName']!: lastNameFieldValue, }; final castedReference = reference.withConverter>( @@ -262,9 +262,9 @@ class _$PersonDocumentReference final json = { ...model.toJson(), if (firstNameFieldValue != null) - _$$PersonImplFieldMap['firstName']!: firstNameFieldValue, + _$PersonFieldMap['firstName']!: firstNameFieldValue, if (lastNameFieldValue != null) - _$$PersonImplFieldMap['lastName']!: lastNameFieldValue, + _$PersonFieldMap['lastName']!: lastNameFieldValue, }; transaction.set(reference, json, options); @@ -280,9 +280,9 @@ class _$PersonDocumentReference final json = { ...model.toJson(), if (firstNameFieldValue != null) - _$$PersonImplFieldMap['firstName']!: firstNameFieldValue, + _$PersonFieldMap['firstName']!: firstNameFieldValue, if (lastNameFieldValue != null) - _$$PersonImplFieldMap['lastName']!: lastNameFieldValue, + _$PersonFieldMap['lastName']!: lastNameFieldValue, }; batch.set(reference, json, options); @@ -304,15 +304,15 @@ class _$PersonDocumentReference ); final json = { if (firstName != _sentinel) - _$$PersonImplFieldMap['firstName']!: - _$$PersonImplPerFieldToJson.firstName(firstName as String), + _$PersonFieldMap['firstName']!: + _$PersonPerFieldToJson.firstName(firstName as String), if (firstNameFieldValue != null) - _$$PersonImplFieldMap['firstName']!: firstNameFieldValue, + _$PersonFieldMap['firstName']!: firstNameFieldValue, if (lastName != _sentinel) - _$$PersonImplFieldMap['lastName']!: - _$$PersonImplPerFieldToJson.lastName(lastName as String), + _$PersonFieldMap['lastName']!: + _$PersonPerFieldToJson.lastName(lastName as String), if (lastNameFieldValue != null) - _$$PersonImplFieldMap['lastName']!: lastNameFieldValue, + _$PersonFieldMap['lastName']!: lastNameFieldValue, }; return reference.update(json); @@ -335,15 +335,15 @@ class _$PersonDocumentReference ); final json = { if (firstName != _sentinel) - _$$PersonImplFieldMap['firstName']!: - _$$PersonImplPerFieldToJson.firstName(firstName as String), + _$PersonFieldMap['firstName']!: + _$PersonPerFieldToJson.firstName(firstName as String), if (firstNameFieldValue != null) - _$$PersonImplFieldMap['firstName']!: firstNameFieldValue, + _$PersonFieldMap['firstName']!: firstNameFieldValue, if (lastName != _sentinel) - _$$PersonImplFieldMap['lastName']!: - _$$PersonImplPerFieldToJson.lastName(lastName as String), + _$PersonFieldMap['lastName']!: + _$PersonPerFieldToJson.lastName(lastName as String), if (lastNameFieldValue != null) - _$$PersonImplFieldMap['lastName']!: lastNameFieldValue, + _$PersonFieldMap['lastName']!: lastNameFieldValue, }; transaction.update(reference, json); @@ -366,15 +366,15 @@ class _$PersonDocumentReference ); final json = { if (firstName != _sentinel) - _$$PersonImplFieldMap['firstName']!: - _$$PersonImplPerFieldToJson.firstName(firstName as String), + _$PersonFieldMap['firstName']!: + _$PersonPerFieldToJson.firstName(firstName as String), if (firstNameFieldValue != null) - _$$PersonImplFieldMap['firstName']!: firstNameFieldValue, + _$PersonFieldMap['firstName']!: firstNameFieldValue, if (lastName != _sentinel) - _$$PersonImplFieldMap['lastName']!: - _$$PersonImplPerFieldToJson.lastName(lastName as String), + _$PersonFieldMap['lastName']!: + _$PersonPerFieldToJson.lastName(lastName as String), if (lastNameFieldValue != null) - _$$PersonImplFieldMap['lastName']!: lastNameFieldValue, + _$PersonFieldMap['lastName']!: lastNameFieldValue, }; batch.update(reference, json); @@ -663,30 +663,27 @@ class _$PersonQuery extends QueryReference return _$PersonQuery( _collection, $referenceWithoutCursor: $referenceWithoutCursor.where( - _$$PersonImplFieldMap['firstName']!, + _$PersonFieldMap['firstName']!, isEqualTo: isEqualTo != _sentinel - ? _$$PersonImplPerFieldToJson.firstName(isEqualTo as String) + ? _$PersonPerFieldToJson.firstName(isEqualTo as String) : null, isNotEqualTo: isNotEqualTo != _sentinel - ? _$$PersonImplPerFieldToJson.firstName(isNotEqualTo as String) + ? _$PersonPerFieldToJson.firstName(isNotEqualTo as String) : null, isLessThan: isLessThan != null - ? _$$PersonImplPerFieldToJson.firstName(isLessThan as String) + ? _$PersonPerFieldToJson.firstName(isLessThan as String) : null, isLessThanOrEqualTo: isLessThanOrEqualTo != null - ? _$$PersonImplPerFieldToJson - .firstName(isLessThanOrEqualTo as String) + ? _$PersonPerFieldToJson.firstName(isLessThanOrEqualTo as String) : null, isGreaterThan: isGreaterThan != null - ? _$$PersonImplPerFieldToJson.firstName(isGreaterThan as String) + ? _$PersonPerFieldToJson.firstName(isGreaterThan as String) : null, isGreaterThanOrEqualTo: isGreaterThanOrEqualTo != null - ? _$$PersonImplPerFieldToJson - .firstName(isGreaterThanOrEqualTo as String) + ? _$PersonPerFieldToJson.firstName(isGreaterThanOrEqualTo as String) : null, - whereIn: whereIn?.map((e) => _$$PersonImplPerFieldToJson.firstName(e)), - whereNotIn: - whereNotIn?.map((e) => _$$PersonImplPerFieldToJson.firstName(e)), + whereIn: whereIn?.map((e) => _$PersonPerFieldToJson.firstName(e)), + whereNotIn: whereNotIn?.map((e) => _$PersonPerFieldToJson.firstName(e)), isNull: isNull ?? (isEqualTo == null ? false : null) ?? (isNotEqualTo == null ? true : null), @@ -710,30 +707,27 @@ class _$PersonQuery extends QueryReference return _$PersonQuery( _collection, $referenceWithoutCursor: $referenceWithoutCursor.where( - _$$PersonImplFieldMap['lastName']!, + _$PersonFieldMap['lastName']!, isEqualTo: isEqualTo != _sentinel - ? _$$PersonImplPerFieldToJson.lastName(isEqualTo as String) + ? _$PersonPerFieldToJson.lastName(isEqualTo as String) : null, isNotEqualTo: isNotEqualTo != _sentinel - ? _$$PersonImplPerFieldToJson.lastName(isNotEqualTo as String) + ? _$PersonPerFieldToJson.lastName(isNotEqualTo as String) : null, isLessThan: isLessThan != null - ? _$$PersonImplPerFieldToJson.lastName(isLessThan as String) + ? _$PersonPerFieldToJson.lastName(isLessThan as String) : null, isLessThanOrEqualTo: isLessThanOrEqualTo != null - ? _$$PersonImplPerFieldToJson - .lastName(isLessThanOrEqualTo as String) + ? _$PersonPerFieldToJson.lastName(isLessThanOrEqualTo as String) : null, isGreaterThan: isGreaterThan != null - ? _$$PersonImplPerFieldToJson.lastName(isGreaterThan as String) + ? _$PersonPerFieldToJson.lastName(isGreaterThan as String) : null, isGreaterThanOrEqualTo: isGreaterThanOrEqualTo != null - ? _$$PersonImplPerFieldToJson - .lastName(isGreaterThanOrEqualTo as String) + ? _$PersonPerFieldToJson.lastName(isGreaterThanOrEqualTo as String) : null, - whereIn: whereIn?.map((e) => _$$PersonImplPerFieldToJson.lastName(e)), - whereNotIn: - whereNotIn?.map((e) => _$$PersonImplPerFieldToJson.lastName(e)), + whereIn: whereIn?.map((e) => _$PersonPerFieldToJson.lastName(e)), + whereNotIn: whereNotIn?.map((e) => _$PersonPerFieldToJson.lastName(e)), isNull: isNull ?? (isEqualTo == null ? false : null) ?? (isNotEqualTo == null ? true : null), @@ -902,7 +896,7 @@ class _$PersonQuery extends QueryReference PersonDocumentSnapshot? startAfterDocument, }) { final query = $referenceWithoutCursor - .orderBy(_$$PersonImplFieldMap['firstName']!, descending: descending); + .orderBy(_$PersonFieldMap['firstName']!, descending: descending); var queryCursor = $queryCursor; if (startAtDocument != null) { @@ -974,8 +968,8 @@ class _$PersonQuery extends QueryReference PersonDocumentSnapshot? endBeforeDocument, PersonDocumentSnapshot? startAfterDocument, }) { - final query = $referenceWithoutCursor - .orderBy(_$$PersonImplFieldMap['lastName']!, descending: descending); + final query = $referenceWithoutCursor.orderBy(_$PersonFieldMap['lastName']!, + descending: descending); var queryCursor = $queryCursor; if (startAtDocument != null) { @@ -1348,7 +1342,7 @@ class _$PublicRedirectedDocumentReference extends FirestoreDocumentReference< final json = { ...model.toJson(), if (valueFieldValue != null) - _$$PublicRedirected2ImplFieldMap['value']!: valueFieldValue, + _$PublicRedirected2FieldMap['value']!: valueFieldValue, }; final castedReference = reference.withConverter>( @@ -1367,7 +1361,7 @@ class _$PublicRedirectedDocumentReference extends FirestoreDocumentReference< final json = { ...model.toJson(), if (valueFieldValue != null) - _$$PublicRedirected2ImplFieldMap['value']!: valueFieldValue, + _$PublicRedirected2FieldMap['value']!: valueFieldValue, }; transaction.set(reference, json, options); @@ -1382,7 +1376,7 @@ class _$PublicRedirectedDocumentReference extends FirestoreDocumentReference< final json = { ...model.toJson(), if (valueFieldValue != null) - _$$PublicRedirected2ImplFieldMap['value']!: valueFieldValue, + _$PublicRedirected2FieldMap['value']!: valueFieldValue, }; batch.set(reference, json, options); @@ -1398,10 +1392,10 @@ class _$PublicRedirectedDocumentReference extends FirestoreDocumentReference< ); final json = { if (value != _sentinel) - _$$PublicRedirected2ImplFieldMap['value']!: - _$$PublicRedirected2ImplPerFieldToJson.value(value as String), + _$PublicRedirected2FieldMap['value']!: + _$PublicRedirected2PerFieldToJson.value(value as String), if (valueFieldValue != null) - _$$PublicRedirected2ImplFieldMap['value']!: valueFieldValue, + _$PublicRedirected2FieldMap['value']!: valueFieldValue, }; return reference.update(json); @@ -1418,10 +1412,10 @@ class _$PublicRedirectedDocumentReference extends FirestoreDocumentReference< ); final json = { if (value != _sentinel) - _$$PublicRedirected2ImplFieldMap['value']!: - _$$PublicRedirected2ImplPerFieldToJson.value(value as String), + _$PublicRedirected2FieldMap['value']!: + _$PublicRedirected2PerFieldToJson.value(value as String), if (valueFieldValue != null) - _$$PublicRedirected2ImplFieldMap['value']!: valueFieldValue, + _$PublicRedirected2FieldMap['value']!: valueFieldValue, }; transaction.update(reference, json); @@ -1438,10 +1432,10 @@ class _$PublicRedirectedDocumentReference extends FirestoreDocumentReference< ); final json = { if (value != _sentinel) - _$$PublicRedirected2ImplFieldMap['value']!: - _$$PublicRedirected2ImplPerFieldToJson.value(value as String), + _$PublicRedirected2FieldMap['value']!: + _$PublicRedirected2PerFieldToJson.value(value as String), if (valueFieldValue != null) - _$$PublicRedirected2ImplFieldMap['value']!: valueFieldValue, + _$PublicRedirected2FieldMap['value']!: valueFieldValue, }; batch.update(reference, json); @@ -1711,33 +1705,31 @@ class _$PublicRedirectedQuery return _$PublicRedirectedQuery( _collection, $referenceWithoutCursor: $referenceWithoutCursor.where( - _$$PublicRedirected2ImplFieldMap['value']!, + _$PublicRedirected2FieldMap['value']!, isEqualTo: isEqualTo != _sentinel - ? _$$PublicRedirected2ImplPerFieldToJson.value(isEqualTo as String) + ? _$PublicRedirected2PerFieldToJson.value(isEqualTo as String) : null, isNotEqualTo: isNotEqualTo != _sentinel - ? _$$PublicRedirected2ImplPerFieldToJson - .value(isNotEqualTo as String) + ? _$PublicRedirected2PerFieldToJson.value(isNotEqualTo as String) : null, isLessThan: isLessThan != null - ? _$$PublicRedirected2ImplPerFieldToJson.value(isLessThan as String) + ? _$PublicRedirected2PerFieldToJson.value(isLessThan as String) : null, isLessThanOrEqualTo: isLessThanOrEqualTo != null - ? _$$PublicRedirected2ImplPerFieldToJson + ? _$PublicRedirected2PerFieldToJson .value(isLessThanOrEqualTo as String) : null, isGreaterThan: isGreaterThan != null - ? _$$PublicRedirected2ImplPerFieldToJson - .value(isGreaterThan as String) + ? _$PublicRedirected2PerFieldToJson.value(isGreaterThan as String) : null, isGreaterThanOrEqualTo: isGreaterThanOrEqualTo != null - ? _$$PublicRedirected2ImplPerFieldToJson + ? _$PublicRedirected2PerFieldToJson .value(isGreaterThanOrEqualTo as String) : null, - whereIn: whereIn - ?.map((e) => _$$PublicRedirected2ImplPerFieldToJson.value(e)), - whereNotIn: whereNotIn - ?.map((e) => _$$PublicRedirected2ImplPerFieldToJson.value(e)), + whereIn: + whereIn?.map((e) => _$PublicRedirected2PerFieldToJson.value(e)), + whereNotIn: + whereNotIn?.map((e) => _$PublicRedirected2PerFieldToJson.value(e)), isNull: isNull ?? (isEqualTo == null ? false : null) ?? (isNotEqualTo == null ? true : null), @@ -1905,9 +1897,8 @@ class _$PublicRedirectedQuery PublicRedirectedDocumentSnapshot? endBeforeDocument, PublicRedirectedDocumentSnapshot? startAfterDocument, }) { - final query = $referenceWithoutCursor.orderBy( - _$$PublicRedirected2ImplFieldMap['value']!, - descending: descending); + final query = $referenceWithoutCursor + .orderBy(_$PublicRedirected2FieldMap['value']!, descending: descending); var queryCursor = $queryCursor; if (startAtDocument != null) { @@ -2066,52 +2057,990 @@ class PublicRedirectedQueryDocumentSnapshot } } -// ************************************************************************** -// JsonSerializableGenerator -// ************************************************************************** +/// A collection reference object can be used for adding documents, +/// getting document references, and querying for documents +/// (using the methods inherited from Query). +abstract class SimpleFreezedCollectionReference + implements + SimpleFreezedQuery, + FirestoreCollectionReference { + factory SimpleFreezedCollectionReference([ + FirebaseFirestore? firestore, + ]) = _$SimpleFreezedCollectionReference; -_$PersonImpl _$$PersonImplFromJson(Map json) => _$PersonImpl( - firstName: json['first_name'] as String, - lastName: json['LAST_NAME'] as String, + static SimpleFreezed fromFirestore( + DocumentSnapshot> snapshot, + SnapshotOptions? options, + ) { + return SimpleFreezed.fromJson(snapshot.data()!); + } + + static Map toFirestore( + SimpleFreezed value, + SetOptions? options, + ) { + return _$SimpleFreezedToJson(value); + } + + @override + CollectionReference get reference; + + @override + SimpleFreezedDocumentReference doc([String? id]); + + /// Add a new document to this collection with the specified data, + /// assigning it a document ID automatically. + Future add(SimpleFreezed value); +} + +class _$SimpleFreezedCollectionReference extends _$SimpleFreezedQuery + implements SimpleFreezedCollectionReference { + factory _$SimpleFreezedCollectionReference([FirebaseFirestore? firestore]) { + firestore ??= FirebaseFirestore.instance; + + return _$SimpleFreezedCollectionReference._( + firestore.collection('freezed-test').withConverter( + fromFirestore: SimpleFreezedCollectionReference.fromFirestore, + toFirestore: SimpleFreezedCollectionReference.toFirestore, + ), ); + } -const _$$PersonImplFieldMap = { - 'firstName': 'first_name', - 'lastName': 'LAST_NAME', -}; + _$SimpleFreezedCollectionReference._( + CollectionReference reference, + ) : super(reference, $referenceWithoutCursor: reference); -// ignore: unused_element -abstract class _$$PersonImplPerFieldToJson { - // ignore: unused_element - static Object? firstName(String instance) => instance; - // ignore: unused_element - static Object? lastName(String instance) => instance; + String get path => reference.path; + + @override + CollectionReference get reference => + super.reference as CollectionReference; + + @override + SimpleFreezedDocumentReference doc([String? id]) { + assert( + id == null || id.split('/').length == 1, + 'The document ID cannot be from a different collection', + ); + return SimpleFreezedDocumentReference( + reference.doc(id), + ); + } + + @override + Future add(SimpleFreezed value) { + return reference + .add(value) + .then((ref) => SimpleFreezedDocumentReference(ref)); + } + + @override + bool operator ==(Object other) { + return other is _$SimpleFreezedCollectionReference && + other.runtimeType == runtimeType && + other.reference == reference; + } + + @override + int get hashCode => Object.hash(runtimeType, reference); } -Map _$$PersonImplToJson(_$PersonImpl instance) => - { +abstract class SimpleFreezedDocumentReference + extends FirestoreDocumentReference { + factory SimpleFreezedDocumentReference( + DocumentReference reference) = + _$SimpleFreezedDocumentReference; + + DocumentReference get reference; + + /// A reference to the [SimpleFreezedCollectionReference] containing this document. + SimpleFreezedCollectionReference get parent { + return _$SimpleFreezedCollectionReference(reference.firestore); + } + + @override + Stream snapshots(); + + @override + Future get([GetOptions? options]); + + @override + Future delete(); + + /// Sets data on the document, overwriting any existing data. If the document + /// does not yet exist, it will be created. + /// + /// If [SetOptions] are provided, the data can be merged into an existing + /// document instead of overwriting. + /// + /// Any [FieldValue]s provided will replace the corresponding fields in the + /// [model] during serialization. + Future set( + SimpleFreezed model, { + SetOptions? options, + FieldValue aFieldValue, + }); + + /// Writes to the document using the transaction API. + /// + /// If the document does not exist yet, it will be created. If you pass + /// [SetOptions], the provided data can be merged into the existing document. + /// + /// Any [FieldValue]s provided will replace the corresponding fields in the + /// [model] during serialization. + void transactionSet( + Transaction transaction, + SimpleFreezed model, { + SetOptions? options, + FieldValue aFieldValue, + }); + + /// Writes to the document using the batch API. + /// + /// If the document does not exist yet, it will be created. If you pass + /// [SetOptions], the provided data can be merged into the existing document. + /// + /// Any [FieldValue]s provided will replace the corresponding fields in the + /// [model] during serialization. + void batchSet( + WriteBatch batch, + SimpleFreezed model, { + SetOptions? options, + FieldValue aFieldValue, + }); + + /// Updates data on the document. Data will be merged with any existing + /// document data. + /// + /// If no document exists yet, the update will fail. + Future update({ + int a, + FieldValue aFieldValue, + }); + + /// Updates fields in the current document using the transaction API. + /// + /// The update will fail if applied to a document that does not exist. + void transactionUpdate( + Transaction transaction, { + int a, + FieldValue aFieldValue, + }); + + /// Updates fields in the current document using the batch API. + /// + /// The update will fail if applied to a document that does not exist. + void batchUpdate( + WriteBatch batch, { + int a, + FieldValue aFieldValue, + }); +} + +class _$SimpleFreezedDocumentReference extends FirestoreDocumentReference< + SimpleFreezed, + SimpleFreezedDocumentSnapshot> implements SimpleFreezedDocumentReference { + _$SimpleFreezedDocumentReference(this.reference); + + @override + final DocumentReference reference; + + /// A reference to the [SimpleFreezedCollectionReference] containing this document. + SimpleFreezedCollectionReference get parent { + return _$SimpleFreezedCollectionReference(reference.firestore); + } + + @override + Stream snapshots() { + return reference.snapshots().map(SimpleFreezedDocumentSnapshot._); + } + + @override + Future get([GetOptions? options]) { + return reference.get(options).then(SimpleFreezedDocumentSnapshot._); + } + + @override + Future transactionGet( + Transaction transaction) { + return transaction.get(reference).then(SimpleFreezedDocumentSnapshot._); + } + + Future set( + SimpleFreezed model, { + SetOptions? options, + FieldValue? aFieldValue, + }) async { + final json = { + ..._$SimpleFreezedToJson(model), + if (aFieldValue != null) _$SimpleFreezedFieldMap['a']!: aFieldValue, + }; + + final castedReference = reference.withConverter>( + fromFirestore: (snapshot, options) => throw UnimplementedError(), + toFirestore: (value, options) => value, + ); + return castedReference.set(json, options); + } + + void transactionSet( + Transaction transaction, + SimpleFreezed model, { + SetOptions? options, + FieldValue? aFieldValue, + }) { + final json = { + ..._$SimpleFreezedToJson(model), + if (aFieldValue != null) _$SimpleFreezedFieldMap['a']!: aFieldValue, + }; + + transaction.set(reference, json, options); + } + + void batchSet( + WriteBatch batch, + SimpleFreezed model, { + SetOptions? options, + FieldValue? aFieldValue, + }) { + final json = { + ..._$SimpleFreezedToJson(model), + if (aFieldValue != null) _$SimpleFreezedFieldMap['a']!: aFieldValue, + }; + + batch.set(reference, json, options); + } + + Future update({ + Object? a = _sentinel, + FieldValue? aFieldValue, + }) async { + assert( + a == _sentinel || aFieldValue == null, + "Cannot specify both a and aFieldValue", + ); + final json = { + if (a != _sentinel) + _$SimpleFreezedFieldMap['a']!: + _$SimpleFreezedPerFieldToJson.a(a as int), + if (aFieldValue != null) _$SimpleFreezedFieldMap['a']!: aFieldValue, + }; + + return reference.update(json); + } + + void transactionUpdate( + Transaction transaction, { + Object? a = _sentinel, + FieldValue? aFieldValue, + }) { + assert( + a == _sentinel || aFieldValue == null, + "Cannot specify both a and aFieldValue", + ); + final json = { + if (a != _sentinel) + _$SimpleFreezedFieldMap['a']!: + _$SimpleFreezedPerFieldToJson.a(a as int), + if (aFieldValue != null) _$SimpleFreezedFieldMap['a']!: aFieldValue, + }; + + transaction.update(reference, json); + } + + void batchUpdate( + WriteBatch batch, { + Object? a = _sentinel, + FieldValue? aFieldValue, + }) { + assert( + a == _sentinel || aFieldValue == null, + "Cannot specify both a and aFieldValue", + ); + final json = { + if (a != _sentinel) + _$SimpleFreezedFieldMap['a']!: + _$SimpleFreezedPerFieldToJson.a(a as int), + if (aFieldValue != null) _$SimpleFreezedFieldMap['a']!: aFieldValue, + }; + + batch.update(reference, json); + } + + @override + bool operator ==(Object other) { + return other is SimpleFreezedDocumentReference && + other.runtimeType == runtimeType && + other.parent == parent && + other.id == id; + } + + @override + int get hashCode => Object.hash(runtimeType, parent, id); +} + +abstract class SimpleFreezedQuery + implements QueryReference { + @override + SimpleFreezedQuery limit(int limit); + + @override + SimpleFreezedQuery limitToLast(int limit); + + /// Perform a where query based on a [FieldPath]. + /// + /// This method is considered unsafe as it does check that the field path + /// maps to a valid property or that parameters such as [isEqualTo] receive + /// a value of the correct type. + /// + /// If possible, instead use the more explicit variant of where queries: + /// + /// **AVOID**: + /// ```dart + /// collection.whereFieldPath(FieldPath.fromString('title'), isEqualTo: 'title'); + /// ``` + /// + /// **PREFER**: + /// ```dart + /// collection.whereTitle(isEqualTo: 'title'); + /// ``` + SimpleFreezedQuery whereFieldPath( + Object fieldPath, { + Object? isEqualTo, + Object? isNotEqualTo, + Object? isLessThan, + Object? isLessThanOrEqualTo, + Object? isGreaterThan, + Object? isGreaterThanOrEqualTo, + Object? arrayContains, + List? arrayContainsAny, + List? whereIn, + List? whereNotIn, + bool? isNull, + }); + + SimpleFreezedQuery whereDocumentId({ + String? isEqualTo, + String? isNotEqualTo, + String? isLessThan, + String? isLessThanOrEqualTo, + String? isGreaterThan, + String? isGreaterThanOrEqualTo, + List? whereIn, + List? whereNotIn, + bool? isNull, + }); + + SimpleFreezedQuery whereA({ + int? isEqualTo, + int? isNotEqualTo, + int? isLessThan, + int? isLessThanOrEqualTo, + int? isGreaterThan, + int? isGreaterThanOrEqualTo, + List? whereIn, + List? whereNotIn, + bool? isNull, + }); + + /// Perform an order query based on a [FieldPath]. + /// + /// This method is considered unsafe as it does check that the field path + /// maps to a valid property or that parameters such as [isEqualTo] receive + /// a value of the correct type. + /// + /// If possible, instead use the more explicit variant of order queries: + /// + /// **AVOID**: + /// ```dart + /// collection.orderByFieldPath( + /// FieldPath.fromString('title'), + /// startAt: 'title', + /// ); + /// ``` + /// + /// **PREFER**: + /// ```dart + /// collection.orderByTitle(startAt: 'title'); + /// ``` + SimpleFreezedQuery orderByFieldPath( + Object fieldPath, { + bool descending = false, + Object startAt, + Object startAfter, + Object endAt, + Object endBefore, + SimpleFreezedDocumentSnapshot? startAtDocument, + SimpleFreezedDocumentSnapshot? endAtDocument, + SimpleFreezedDocumentSnapshot? endBeforeDocument, + SimpleFreezedDocumentSnapshot? startAfterDocument, + }); + + SimpleFreezedQuery orderByDocumentId({ + bool descending = false, + String startAt, + String startAfter, + String endAt, + String endBefore, + SimpleFreezedDocumentSnapshot? startAtDocument, + SimpleFreezedDocumentSnapshot? endAtDocument, + SimpleFreezedDocumentSnapshot? endBeforeDocument, + SimpleFreezedDocumentSnapshot? startAfterDocument, + }); + + SimpleFreezedQuery orderByA({ + bool descending = false, + int startAt, + int startAfter, + int endAt, + int endBefore, + SimpleFreezedDocumentSnapshot? startAtDocument, + SimpleFreezedDocumentSnapshot? endAtDocument, + SimpleFreezedDocumentSnapshot? endBeforeDocument, + SimpleFreezedDocumentSnapshot? startAfterDocument, + }); +} + +class _$SimpleFreezedQuery + extends QueryReference + implements SimpleFreezedQuery { + _$SimpleFreezedQuery( + this._collection, { + required Query $referenceWithoutCursor, + $QueryCursor $queryCursor = const $QueryCursor(), + }) : super( + $referenceWithoutCursor: $referenceWithoutCursor, + $queryCursor: $queryCursor, + ); + + final CollectionReference _collection; + + @override + Stream snapshots([SnapshotOptions? options]) { + return reference + .snapshots() + .map(SimpleFreezedQuerySnapshot._fromQuerySnapshot); + } + + @override + Future get([GetOptions? options]) { + return reference + .get(options) + .then(SimpleFreezedQuerySnapshot._fromQuerySnapshot); + } + + @override + SimpleFreezedQuery limit(int limit) { + return _$SimpleFreezedQuery( + _collection, + $referenceWithoutCursor: $referenceWithoutCursor.limit(limit), + $queryCursor: $queryCursor, + ); + } + + @override + SimpleFreezedQuery limitToLast(int limit) { + return _$SimpleFreezedQuery( + _collection, + $referenceWithoutCursor: $referenceWithoutCursor.limitToLast(limit), + $queryCursor: $queryCursor, + ); + } + + @override + SimpleFreezedQuery whereFieldPath( + Object fieldPath, { + Object? isEqualTo = _sentinel, + Object? isNotEqualTo = _sentinel, + Object? isLessThan, + Object? isLessThanOrEqualTo, + Object? isGreaterThan, + Object? isGreaterThanOrEqualTo, + Object? arrayContains, + List? arrayContainsAny, + List? whereIn, + List? whereNotIn, + bool? isNull, + }) { + return _$SimpleFreezedQuery( + _collection, + $referenceWithoutCursor: $referenceWithoutCursor.where( + fieldPath, + isEqualTo: isEqualTo != _sentinel ? isEqualTo : null, + isNotEqualTo: isNotEqualTo != _sentinel ? isNotEqualTo : null, + isLessThan: isLessThan, + isLessThanOrEqualTo: isLessThanOrEqualTo, + isGreaterThan: isGreaterThan, + isGreaterThanOrEqualTo: isGreaterThanOrEqualTo, + arrayContains: arrayContains, + arrayContainsAny: arrayContainsAny, + whereIn: whereIn, + whereNotIn: whereNotIn, + isNull: isNull ?? + (isEqualTo == null ? false : null) ?? + (isNotEqualTo == null ? true : null), + ), + $queryCursor: $queryCursor, + ); + } + + @override + SimpleFreezedQuery whereDocumentId({ + Object? isEqualTo = _sentinel, + Object? isNotEqualTo = _sentinel, + Object? isLessThan, + Object? isLessThanOrEqualTo, + Object? isGreaterThan, + Object? isGreaterThanOrEqualTo, + List? whereIn, + List? whereNotIn, + bool? isNull, + }) { + return _$SimpleFreezedQuery( + _collection, + $referenceWithoutCursor: $referenceWithoutCursor.where( + FieldPath.documentId, + isEqualTo: isEqualTo != _sentinel ? isEqualTo : null, + isNotEqualTo: isNotEqualTo != _sentinel ? isNotEqualTo : null, + isLessThan: isLessThan, + isLessThanOrEqualTo: isLessThanOrEqualTo, + isGreaterThan: isGreaterThan, + isGreaterThanOrEqualTo: isGreaterThanOrEqualTo, + whereIn: whereIn, + whereNotIn: whereNotIn, + isNull: isNull ?? + (isEqualTo == null ? false : null) ?? + (isNotEqualTo == null ? true : null), + ), + $queryCursor: $queryCursor, + ); + } + + @override + SimpleFreezedQuery whereA({ + Object? isEqualTo = _sentinel, + Object? isNotEqualTo = _sentinel, + Object? isLessThan, + Object? isLessThanOrEqualTo, + Object? isGreaterThan, + Object? isGreaterThanOrEqualTo, + List? whereIn, + List? whereNotIn, + bool? isNull, + }) { + return _$SimpleFreezedQuery( + _collection, + $referenceWithoutCursor: $referenceWithoutCursor.where( + _$SimpleFreezedFieldMap['a']!, + isEqualTo: isEqualTo != _sentinel + ? _$SimpleFreezedPerFieldToJson.a(isEqualTo as int) + : null, + isNotEqualTo: isNotEqualTo != _sentinel + ? _$SimpleFreezedPerFieldToJson.a(isNotEqualTo as int) + : null, + isLessThan: isLessThan != null + ? _$SimpleFreezedPerFieldToJson.a(isLessThan as int) + : null, + isLessThanOrEqualTo: isLessThanOrEqualTo != null + ? _$SimpleFreezedPerFieldToJson.a(isLessThanOrEqualTo as int) + : null, + isGreaterThan: isGreaterThan != null + ? _$SimpleFreezedPerFieldToJson.a(isGreaterThan as int) + : null, + isGreaterThanOrEqualTo: isGreaterThanOrEqualTo != null + ? _$SimpleFreezedPerFieldToJson.a(isGreaterThanOrEqualTo as int) + : null, + whereIn: whereIn?.map((e) => _$SimpleFreezedPerFieldToJson.a(e)), + whereNotIn: whereNotIn?.map((e) => _$SimpleFreezedPerFieldToJson.a(e)), + isNull: isNull ?? + (isEqualTo == null ? false : null) ?? + (isNotEqualTo == null ? true : null), + ), + $queryCursor: $queryCursor, + ); + } + + @override + SimpleFreezedQuery orderByFieldPath( + Object fieldPath, { + bool descending = false, + Object? startAt = _sentinel, + Object? startAfter = _sentinel, + Object? endAt = _sentinel, + Object? endBefore = _sentinel, + SimpleFreezedDocumentSnapshot? startAtDocument, + SimpleFreezedDocumentSnapshot? endAtDocument, + SimpleFreezedDocumentSnapshot? endBeforeDocument, + SimpleFreezedDocumentSnapshot? startAfterDocument, + }) { + final query = + $referenceWithoutCursor.orderBy(fieldPath, descending: descending); + var queryCursor = $queryCursor; + + if (startAtDocument != null) { + queryCursor = queryCursor.copyWith( + startAt: const [], + startAtDocumentSnapshot: startAtDocument.snapshot, + ); + } + if (startAfterDocument != null) { + queryCursor = queryCursor.copyWith( + startAfter: const [], + startAfterDocumentSnapshot: startAfterDocument.snapshot, + ); + } + if (endAtDocument != null) { + queryCursor = queryCursor.copyWith( + endAt: const [], + endAtDocumentSnapshot: endAtDocument.snapshot, + ); + } + if (endBeforeDocument != null) { + queryCursor = queryCursor.copyWith( + endBefore: const [], + endBeforeDocumentSnapshot: endBeforeDocument.snapshot, + ); + } + + if (startAt != _sentinel) { + queryCursor = queryCursor.copyWith( + startAt: [...queryCursor.startAt, startAt], + startAtDocumentSnapshot: null, + ); + } + if (startAfter != _sentinel) { + queryCursor = queryCursor.copyWith( + startAfter: [...queryCursor.startAfter, startAfter], + startAfterDocumentSnapshot: null, + ); + } + if (endAt != _sentinel) { + queryCursor = queryCursor.copyWith( + endAt: [...queryCursor.endAt, endAt], + endAtDocumentSnapshot: null, + ); + } + if (endBefore != _sentinel) { + queryCursor = queryCursor.copyWith( + endBefore: [...queryCursor.endBefore, endBefore], + endBeforeDocumentSnapshot: null, + ); + } + + return _$SimpleFreezedQuery( + _collection, + $referenceWithoutCursor: query, + $queryCursor: queryCursor, + ); + } + + @override + SimpleFreezedQuery orderByDocumentId({ + bool descending = false, + Object? startAt = _sentinel, + Object? startAfter = _sentinel, + Object? endAt = _sentinel, + Object? endBefore = _sentinel, + SimpleFreezedDocumentSnapshot? startAtDocument, + SimpleFreezedDocumentSnapshot? endAtDocument, + SimpleFreezedDocumentSnapshot? endBeforeDocument, + SimpleFreezedDocumentSnapshot? startAfterDocument, + }) { + final query = $referenceWithoutCursor.orderBy(FieldPath.documentId, + descending: descending); + var queryCursor = $queryCursor; + + if (startAtDocument != null) { + queryCursor = queryCursor.copyWith( + startAt: const [], + startAtDocumentSnapshot: startAtDocument.snapshot, + ); + } + if (startAfterDocument != null) { + queryCursor = queryCursor.copyWith( + startAfter: const [], + startAfterDocumentSnapshot: startAfterDocument.snapshot, + ); + } + if (endAtDocument != null) { + queryCursor = queryCursor.copyWith( + endAt: const [], + endAtDocumentSnapshot: endAtDocument.snapshot, + ); + } + if (endBeforeDocument != null) { + queryCursor = queryCursor.copyWith( + endBefore: const [], + endBeforeDocumentSnapshot: endBeforeDocument.snapshot, + ); + } + + if (startAt != _sentinel) { + queryCursor = queryCursor.copyWith( + startAt: [...queryCursor.startAt, startAt], + startAtDocumentSnapshot: null, + ); + } + if (startAfter != _sentinel) { + queryCursor = queryCursor.copyWith( + startAfter: [...queryCursor.startAfter, startAfter], + startAfterDocumentSnapshot: null, + ); + } + if (endAt != _sentinel) { + queryCursor = queryCursor.copyWith( + endAt: [...queryCursor.endAt, endAt], + endAtDocumentSnapshot: null, + ); + } + if (endBefore != _sentinel) { + queryCursor = queryCursor.copyWith( + endBefore: [...queryCursor.endBefore, endBefore], + endBeforeDocumentSnapshot: null, + ); + } + + return _$SimpleFreezedQuery( + _collection, + $referenceWithoutCursor: query, + $queryCursor: queryCursor, + ); + } + + @override + SimpleFreezedQuery orderByA({ + bool descending = false, + Object? startAt = _sentinel, + Object? startAfter = _sentinel, + Object? endAt = _sentinel, + Object? endBefore = _sentinel, + SimpleFreezedDocumentSnapshot? startAtDocument, + SimpleFreezedDocumentSnapshot? endAtDocument, + SimpleFreezedDocumentSnapshot? endBeforeDocument, + SimpleFreezedDocumentSnapshot? startAfterDocument, + }) { + final query = $referenceWithoutCursor.orderBy(_$SimpleFreezedFieldMap['a']!, + descending: descending); + var queryCursor = $queryCursor; + + if (startAtDocument != null) { + queryCursor = queryCursor.copyWith( + startAt: const [], + startAtDocumentSnapshot: startAtDocument.snapshot, + ); + } + if (startAfterDocument != null) { + queryCursor = queryCursor.copyWith( + startAfter: const [], + startAfterDocumentSnapshot: startAfterDocument.snapshot, + ); + } + if (endAtDocument != null) { + queryCursor = queryCursor.copyWith( + endAt: const [], + endAtDocumentSnapshot: endAtDocument.snapshot, + ); + } + if (endBeforeDocument != null) { + queryCursor = queryCursor.copyWith( + endBefore: const [], + endBeforeDocumentSnapshot: endBeforeDocument.snapshot, + ); + } + + if (startAt != _sentinel) { + queryCursor = queryCursor.copyWith( + startAt: [...queryCursor.startAt, startAt], + startAtDocumentSnapshot: null, + ); + } + if (startAfter != _sentinel) { + queryCursor = queryCursor.copyWith( + startAfter: [...queryCursor.startAfter, startAfter], + startAfterDocumentSnapshot: null, + ); + } + if (endAt != _sentinel) { + queryCursor = queryCursor.copyWith( + endAt: [...queryCursor.endAt, endAt], + endAtDocumentSnapshot: null, + ); + } + if (endBefore != _sentinel) { + queryCursor = queryCursor.copyWith( + endBefore: [...queryCursor.endBefore, endBefore], + endBeforeDocumentSnapshot: null, + ); + } + + return _$SimpleFreezedQuery( + _collection, + $referenceWithoutCursor: query, + $queryCursor: queryCursor, + ); + } + + @override + bool operator ==(Object other) { + return other is _$SimpleFreezedQuery && + other.runtimeType == runtimeType && + other.reference == reference; + } + + @override + int get hashCode => Object.hash(runtimeType, reference); +} + +class SimpleFreezedDocumentSnapshot + extends FirestoreDocumentSnapshot { + SimpleFreezedDocumentSnapshot._(this.snapshot) : data = snapshot.data(); + + @override + final DocumentSnapshot snapshot; + + @override + SimpleFreezedDocumentReference get reference { + return SimpleFreezedDocumentReference( + snapshot.reference, + ); + } + + @override + final SimpleFreezed? data; +} + +class SimpleFreezedQuerySnapshot extends FirestoreQuerySnapshot { + SimpleFreezedQuerySnapshot._( + this.snapshot, + this.docs, + this.docChanges, + ); + + factory SimpleFreezedQuerySnapshot._fromQuerySnapshot( + QuerySnapshot snapshot, + ) { + final docs = + snapshot.docs.map(SimpleFreezedQueryDocumentSnapshot._).toList(); + + final docChanges = snapshot.docChanges.map((change) { + return _decodeDocumentChange( + change, + SimpleFreezedDocumentSnapshot._, + ); + }).toList(); + + return SimpleFreezedQuerySnapshot._( + snapshot, + docs, + docChanges, + ); + } + + static FirestoreDocumentChange + _decodeDocumentChange( + DocumentChange docChange, + SimpleFreezedDocumentSnapshot Function(DocumentSnapshot doc) decodeDoc, + ) { + return FirestoreDocumentChange( + type: docChange.type, + oldIndex: docChange.oldIndex, + newIndex: docChange.newIndex, + doc: decodeDoc(docChange.doc), + ); + } + + final QuerySnapshot snapshot; + + @override + final List docs; + + @override + final List> docChanges; +} + +class SimpleFreezedQueryDocumentSnapshot + extends FirestoreQueryDocumentSnapshot + implements SimpleFreezedDocumentSnapshot { + SimpleFreezedQueryDocumentSnapshot._(this.snapshot) : data = snapshot.data(); + + @override + final QueryDocumentSnapshot snapshot; + + @override + final SimpleFreezed data; + + @override + SimpleFreezedDocumentReference get reference { + return SimpleFreezedDocumentReference(snapshot.reference); + } +} + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +SimpleFreezed _$SimpleFreezedFromJson(Map json) => + SimpleFreezed( + a: (json['a'] as num).toInt(), + ); + +const _$SimpleFreezedFieldMap = { + 'a': 'a', +}; + +// ignore: unused_element +abstract class _$SimpleFreezedPerFieldToJson { + // ignore: unused_element + static Object? a(int instance) => instance; +} + +Map _$SimpleFreezedToJson(SimpleFreezed instance) => + { + 'a': instance.a, + }; + +_Person _$PersonFromJson(Map json) => _Person( + firstName: json['first_name'] as String, + lastName: json['LAST_NAME'] as String, + ); + +const _$PersonFieldMap = { + 'firstName': 'first_name', + 'lastName': 'LAST_NAME', +}; + +// ignore: unused_element +abstract class _$PersonPerFieldToJson { + // ignore: unused_element + static Object? firstName(String instance) => instance; + // ignore: unused_element + static Object? lastName(String instance) => instance; +} + +Map _$PersonToJson(_Person instance) => { 'first_name': instance.firstName, 'LAST_NAME': instance.lastName, }; -_$PublicRedirected2Impl _$$PublicRedirected2ImplFromJson( - Map json) => - _$PublicRedirected2Impl( +PublicRedirected2 _$PublicRedirected2FromJson(Map json) => + PublicRedirected2( value: json['value'] as String, ); -const _$$PublicRedirected2ImplFieldMap = { +const _$PublicRedirected2FieldMap = { 'value': 'value', }; // ignore: unused_element -abstract class _$$PublicRedirected2ImplPerFieldToJson { +abstract class _$PublicRedirected2PerFieldToJson { // ignore: unused_element static Object? value(String instance) => instance; } -Map _$$PublicRedirected2ImplToJson( - _$PublicRedirected2Impl instance) => +Map _$PublicRedirected2ToJson(PublicRedirected2 instance) => { 'value': instance.value, }; diff --git a/packages/cloud_firestore_odm_generator/cloud_firestore_odm_generator_integration_test/pubspec.yaml b/packages/cloud_firestore_odm_generator/cloud_firestore_odm_generator_integration_test/pubspec.yaml index b3d3235..f574814 100644 --- a/packages/cloud_firestore_odm_generator/cloud_firestore_odm_generator_integration_test/pubspec.yaml +++ b/packages/cloud_firestore_odm_generator/cloud_firestore_odm_generator_integration_test/pubspec.yaml @@ -2,25 +2,27 @@ name: cloud_firestore_odm_generator_integration_test publish_to: none environment: - sdk: '>=2.18.0 <4.0.0' + sdk: ">=3.0.0 <4.0.0" dependencies: - cloud_firestore: ^5.0.0 - cloud_firestore_odm: ^1.0.0-dev.85 + cloud_firestore: ^5.0.2 + cloud_firestore_odm: ^1.1.0 flutter: sdk: flutter - freezed_annotation: ^2.2.0 - json_annotation: ^4.8.1 + freezed_annotation: ^3.0.0 + json_annotation: ^4.9.0 meta: ^1.12.0 dev_dependencies: - build_runner: ^2.4.2 + build_runner: ^2.4.8 cloud_firestore_odm_generator: path: ../ flutter_test: sdk: flutter - freezed: ^2.3.2 - json_serializable: '>=6.6.1 <7.0.0' + freezed: ^3.0.2 + json_serializable: ^6.9.4 + test: ^1.25.1 + firebase_core_platform_interface: ^5.0.0 dependency_overrides: cloud_firestore_odm: diff --git a/packages/cloud_firestore_odm_generator/cloud_firestore_odm_generator_integration_test/test/collection_test.dart b/packages/cloud_firestore_odm_generator/cloud_firestore_odm_generator_integration_test/test/collection_test.dart index fb768c9..7970f35 100644 --- a/packages/cloud_firestore_odm_generator/cloud_firestore_odm_generator_integration_test/test/collection_test.dart +++ b/packages/cloud_firestore_odm_generator/cloud_firestore_odm_generator_integration_test/test/collection_test.dart @@ -2,13 +2,14 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. +import 'package:cloud_firestore_odm_generator_integration_test/freezed.dart'; import 'package:cloud_firestore_odm_generator_integration_test/simple.dart'; import 'package:flutter_test/flutter_test.dart'; import 'setup_firestore_mock.dart'; void main() { - setUpAll(setupCloudFirestoreMocks); + setUpAll(setupFirestoreMocks); test('can specify @Collection on the model itself', () { expect( @@ -49,4 +50,24 @@ void main() { ); }); }); + + /// test freezed mixed mode classes + group('freezed mixed mode classes', () { + test('test freezed simple classes', () { + final simpleFreezed = SimpleFreezed(a: 42); + expect(simpleFreezed.toJson(), {'a': 42}); + + final simpleFreezedFromJson = SimpleFreezed.fromJson({'a': 42}); + expect(simpleFreezedFromJson.a, 42); + }); + + test('test freezed factory classes', () { + final publicRedirected = PublicRedirected(value: 'test'); + expect(publicRedirected.toJson(), {'value': 'test'}); + + final publicRedirectedFromJson = + PublicRedirected.fromJson({'value': 'test'}); + expect(publicRedirectedFromJson.value, 'test'); + }); + }); } diff --git a/packages/cloud_firestore_odm_generator/cloud_firestore_odm_generator_integration_test/test/setup_firestore_mock.dart b/packages/cloud_firestore_odm_generator/cloud_firestore_odm_generator_integration_test/test/setup_firestore_mock.dart index b406e47..9bd0210 100644 --- a/packages/cloud_firestore_odm_generator/cloud_firestore_odm_generator_integration_test/test/setup_firestore_mock.dart +++ b/packages/cloud_firestore_odm_generator/cloud_firestore_odm_generator_integration_test/test/setup_firestore_mock.dart @@ -2,13 +2,57 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. -import 'package:firebase_core/firebase_core.dart'; import 'package:firebase_core_platform_interface/firebase_core_platform_interface.dart'; import 'package:flutter_test/flutter_test.dart'; -Future setupCloudFirestoreMocks() async { +void setupFirestoreMocks() { TestWidgetsFlutterBinding.ensureInitialized(); - setupFirebaseCoreMocks(); - await Firebase.initializeApp(); + // Mock Platform Interface + final platform = FirebasePlatform.instance; + if (platform is! MockFirebasePlatform) { + // Register Mock if not already registered + FirebasePlatform.instance = MockFirebasePlatform(); + } +} + +class MockFirebasePlatform extends FirebasePlatform { + @override + bool get isAutomaticDataCollectionEnabled => true; + + @override + Future initializeApp({ + String? name, + FirebaseOptions? options, + }) async { + return MockFirebaseAppPlatform(); + } + + @override + FirebaseAppPlatform app([String name = defaultFirebaseAppName]) { + return MockFirebaseAppPlatform(); + } +} + +class MockFirebaseAppPlatform extends FirebaseAppPlatform { + MockFirebaseAppPlatform() + : super( + defaultFirebaseAppName, + const FirebaseOptions( + apiKey: 'mock-api-key', + appId: 'mock-app-id', + messagingSenderId: 'mock-sender-id', + projectId: 'mock-project-id', + )); + + @override + String get name => defaultFirebaseAppName; + + @override + FirebaseOptions get options => const FirebaseOptions( + apiKey: 'mock-api-key', + appId: 'mock-app-id', + messagingSenderId: 'mock-sender-id', + projectId: 'mock-project-id', + ); } diff --git a/packages/cloud_firestore_odm_generator/lib/src/collection_data.dart b/packages/cloud_firestore_odm_generator/lib/src/collection_data.dart index 83ad3ec..8cc9672 100644 --- a/packages/cloud_firestore_odm_generator/lib/src/collection_data.dart +++ b/packages/cloud_firestore_odm_generator/lib/src/collection_data.dart @@ -196,7 +196,7 @@ represents the content of the collection must be in the same file. .allMethods .firstWhereOrNull((method) => method.name == 'toJson'); final redirectedFreezedClass = redirectedFreezedConstructors - .singleOrNull?.redirectedConstructor!.enclosingElement.name; + .singleOrNull?.redirectedConstructor!.enclosingElement3.name; final generatedJsonTypePrefix = _generatedJsonTypePrefix( hasFreezed: hasFreezed, redirectedFreezedClass: redirectedFreezedClass, @@ -377,7 +377,10 @@ represents the content of the collection must be in the same file. required String collectionTargetElementPublicType, }) { if (hasFreezed) { - return '_\$\$${redirectedFreezedClass?.public}Impl'; + final className = + redirectedFreezedClass?.public ?? collectionTargetElementPublicType; + // Only support freezed 3.x or higher + return '_\$$className'; } else { return '_\$$collectionTargetElementPublicType'; } @@ -427,7 +430,21 @@ extension on ClassElement { required List freezedConstructors, }) { if (hasFreezed) { - return freezedConstructors.single.parameters; + /// For Freezed 3.x, support mixed mode classes. There can be the classic freezed way with a factory, + /// or there can be simple regular classes with a normal constructor. + /// + /// We need to find the factory constructor, or the normal constructor if there is no factory. + final factoryConstructor = freezedConstructors.firstWhereOrNull( + (ctor) => + ctor.isFactory && + !ctor.name.startsWith('_') && + ctor.name != 'fromJson', + ); + if (factoryConstructor == null) { + // No factory constructor, use the normal constructor + return fields; + } + return factoryConstructor.parameters; } else { final uniqueFields = {}; diff --git a/packages/cloud_firestore_odm_generator/lib/src/validator_generator.dart b/packages/cloud_firestore_odm_generator/lib/src/validator_generator.dart index 44e7a89..d9811c9 100644 --- a/packages/cloud_firestore_odm_generator/lib/src/validator_generator.dart +++ b/packages/cloud_firestore_odm_generator/lib/src/validator_generator.dart @@ -40,7 +40,7 @@ bool isValidatorAnnotation(ElementAnnotation annotation) { final element = annotation.element; if (element == null || element is! ConstructorElement) return false; - return element.enclosingElement.allSupertypes.any((superType) { + return element.enclosingElement3.allSupertypes.any((superType) { return superType.element.name == 'Validator' && superType.element.librarySource.uri.toString() == 'package:cloud_firestore_odm/src/validator.dart'; diff --git a/packages/cloud_firestore_odm_generator/pubspec.yaml b/packages/cloud_firestore_odm_generator/pubspec.yaml index fdab7d5..0a23742 100644 --- a/packages/cloud_firestore_odm_generator/pubspec.yaml +++ b/packages/cloud_firestore_odm_generator/pubspec.yaml @@ -2,29 +2,29 @@ name: cloud_firestore_odm_generator description: A code generator for cloud_firestore_odm. homepage: https://firebase.flutter.dev/docs/firestore/odm repository: https://github.com/firebaseextended/firestoreodm-flutter -version: 1.0.0-dev.90 +version: 1.1.0 environment: - sdk: ">=2.18.0 <4.0.0" + sdk: ">=3.0.0 <4.0.0" dependencies: - analyzer: ">=5.12.0 <7.0.0" - build: ^2.0.1 - build_config: ^1.0.0 - cloud_firestore_odm: ^1.0.0-dev.87 - collection: ^1.15.0 - freezed_annotation: ">=1.0.0 <3.0.0" + analyzer: ">=5.12.0 <8.0.0" + build: ^2.4.1 + build_config: ^1.1.2 + cloud_firestore_odm: ^1.1.0 + collection: ^1.18.0 + freezed_annotation: ^3.0.0 # Can be removed once this is fixed https://github.com/dart-lang/graphs/issues/86 - graphs: ^2.0.0 - json_annotation: ^4.8.1 - meta: ^1.8.0 - recase: ^4.0.0 - source_gen: ^1.3.2 + graphs: ^2.3.1 + json_annotation: ^4.9.0 + meta: ^1.12.0 + recase: ^4.1.0 + source_gen: ^2.0.0 source_helper: ^1.3.4 dev_dependencies: - build_runner: ^2.4.2 - expect_error: ^1.0.5 - json_serializable: ">=6.3.0 <7.0.0" - matcher: ^0.12.10 - test: ^1.16.8 + build_runner: ^2.4.8 + expect_error: ^1.0.8 + json_serializable: ^6.9.4 + matcher: ^0.12.16 + test: ^1.25.1 From a463de0355c1981eb5793de02171672ca4d1f1e9 Mon Sep 17 00:00:00 2001 From: dorklein Date: Fri, 29 Aug 2025 13:07:25 +0700 Subject: [PATCH 2/7] chore: Update cloud_firestore_odm and generator to version 1.2.0 - Upgrade cloud_firestore dependency to ^6.0.0 - Update pubspec.yaml and CHANGELOG for versioning - Modify transaction and batch methods to remove 'id' field from documents - Enhance testing setup in README for running integration tests - Add new tests for Freezed and other integration scenarios --- README.md | 18 + packages/cloud_firestore_odm/CHANGELOG.md | 3 + .../cloud_firestore_odm_e2e_test.dart | 4 +- .../collection_reference_test.dart | 182 ++--- .../example/integration_test/common.dart | 3 +- .../document_reference_test.dart | 53 +- .../firestore_builder_test.dart | 11 +- .../integration_test/freezed_test.dart | 22 +- .../example/integration_test/path_test.dart | 27 +- .../query_reference_test.dart | 39 +- .../example/lib/integration.g.dart | 104 ++- .../example/lib/integration/enums.g.dart | 112 ++- .../lib/integration/freezed.freezed.dart | 331 ++++++++- .../example/lib/integration/freezed.g.dart | 84 ++- .../lib/integration/named_query.g.dart | 32 +- .../example/lib/integration/query.g.dart | 164 ++++- .../example/lib/movie.g.dart | 223 ++++-- .../cloud_firestore_odm/example/pubspec.yaml | 6 +- .../example/web/index.html | 68 +- packages/cloud_firestore_odm/pubspec.yaml | 6 +- .../CHANGELOG.md | 4 + .../lib/freezed.freezed.dart | 466 +++++++++++- .../lib/freezed.g.dart | 124 +++- .../lib/simple.g.dart | 696 ++++++++++++++---- .../pubspec.yaml | 6 +- .../lib/src/templates/document_reference.dart | 27 +- .../lib/src/templates/query_reference.dart | 35 +- .../pubspec.yaml | 4 +- scripts/run-tests.sh | 22 + 29 files changed, 2247 insertions(+), 629 deletions(-) create mode 100755 scripts/run-tests.sh diff --git a/README.md b/README.md index f7a4df6..c0cf42a 100644 --- a/README.md +++ b/README.md @@ -110,6 +110,24 @@ class MyModel {...} Once installed, read the documentation on [defining models](./docs/defining-models.md). + +## Development +### Testing +To run tests, you should have chromedriver install on your system. +```shell +./scripts/run-tests.sh +``` +Note: make sure in `packages/cloud_firestore_odm_generator/pubspec.yaml` to replace +``` +cloud_firestore_odm: {VERSION} +``` +with +``` +cloud_firestore_odm: + path: ../cloud_firestore_odm +``` +This is required for the tests to run. Set back to correct version before deploying. + ## Issues and feedback Please file FlutterFire specific issues, bugs, or feature requests in our [issue tracker](https://github.com/firebaseextended/firestoreodm-flutter/issues/new). diff --git a/packages/cloud_firestore_odm/CHANGELOG.md b/packages/cloud_firestore_odm/CHANGELOG.md index 1ccb554..8b10346 100644 --- a/packages/cloud_firestore_odm/CHANGELOG.md +++ b/packages/cloud_firestore_odm/CHANGELOG.md @@ -1,3 +1,6 @@ +## 1.2.0 +- **CHORE**: Update cloud_firestore to ^6.0.0 + ## 1.1.0 - **FIX**: Resolve compatibility issues with Freezed 3.0.0 and above diff --git a/packages/cloud_firestore_odm/example/integration_test/cloud_firestore_odm_e2e_test.dart b/packages/cloud_firestore_odm/example/integration_test/cloud_firestore_odm_e2e_test.dart index 6b1642c..3875a50 100644 --- a/packages/cloud_firestore_odm/example/integration_test/cloud_firestore_odm_e2e_test.dart +++ b/packages/cloud_firestore_odm/example/integration_test/cloud_firestore_odm_e2e_test.dart @@ -9,9 +9,8 @@ import 'package:integration_test/integration_test.dart'; import 'collection_reference_test.dart' as collection_reference_test; import 'document_reference_test.dart' as document_reference_test; - import 'firebase_options.dart'; - +import 'freezed_test.dart' as freezed_test; import 'path_test.dart' as path_test; import 'query_reference_test.dart' as query_reference_test; @@ -32,5 +31,6 @@ void main() { // firestore_builder_test.main(); query_reference_test.main(); path_test.main(); + freezed_test.main(); }); } diff --git a/packages/cloud_firestore_odm/example/integration_test/collection_reference_test.dart b/packages/cloud_firestore_odm/example/integration_test/collection_reference_test.dart index 2d9ec22..82b77a0 100644 --- a/packages/cloud_firestore_odm/example/integration_test/collection_reference_test.dart +++ b/packages/cloud_firestore_odm/example/integration_test/collection_reference_test.dart @@ -49,16 +49,12 @@ void main() { expect(b.data?.id, '456'); }); - test( - 'When using @Id, set/update do not insert an "id" property in the document', - () async { + test('When using @Id, set/update do not insert an "id" property in the document', () async { final collection = await initializeTest(MovieCollectionReference()); await collection.doc('123').set(createMovie(title: 'a', id: '42')); - final snapshot = await FirebaseFirestore.instance - .doc(collection.doc('123').path) - .get(); + final snapshot = await FirebaseFirestore.instance.doc(collection.doc('123').path).get(); expect(snapshot.data()?.containsKey('id'), false); }); @@ -67,8 +63,7 @@ void main() { test('reference', () async { expect( MovieCollectionReference().reference, - isA>() - .having((e) => e.path, 'path', 'firestore-example-app'), + isA>().having((e) => e.path, 'path', 'firestore-example-app'), ); expect( @@ -137,14 +132,12 @@ void main() { expect( await stream.next, isA().having((e) => e.docs, 'doc', [ - isA() - .having((e) => e.data.title, 'data.title', 'title'), + isA().having((e) => e.data.title, 'data.title', 'title'), ]), ); }); - test('emits an error if decoding fails, but keeps listening to updates', - () async { + test('emits an error if decoding fails, but keeps listening to updates', () async { final collection = await initializeTest(MovieCollectionReference()); await FirebaseFirestore.instance @@ -185,8 +178,7 @@ void main() { }); group('doc', () { - test('generates a custom ID for documents if none is specified', - () async { + test('generates a custom ID for documents if none is specified', () async { final collection = await initializeTest(MovieCollectionReference()); final doc = collection.doc(); @@ -200,10 +192,7 @@ void main() { test('can specify a custom ID to obtain an existing doc', () async { final collection = await initializeTest(MovieCollectionReference()); - await FirebaseFirestore.instance - .collection('firestore-example-app') - .doc('123') - .set( + await FirebaseFirestore.instance.collection('firestore-example-app').doc('123').set( MovieCollectionReference.toFirestore( createMovie(title: 'title'), null, @@ -217,8 +206,7 @@ void main() { expect( await doc.get(), - isA() - .having((e) => e.data?.title, 'data.title', 'title'), + isA().having((e) => e.data?.title, 'data.title', 'title'), ); }); }); @@ -256,16 +244,14 @@ void main() { stream, emits( isA().having((e) => e.docs, 'doc', [ - isA() - .having((e) => e.data.title, 'data.title', 'Foo'), + isA().having((e) => e.data.title, 'data.title', 'Foo'), ]), ), ); expect( await newDoc.get(), - isA() - .having((e) => e.data?.title, 'data.title', 'Foo'), + isA().having((e) => e.data?.title, 'data.title', 'Foo'), ); }); @@ -282,10 +268,8 @@ void main() { expect( querySnap.docs, [ - isA() - .having((d) => d.data.title, 'data.title', 'A'), - isA() - .having((d) => d.data.title, 'data.title', 'B'), + isA().having((d) => d.data.title, 'data.title', 'A'), + isA().having((d) => d.data.title, 'data.title', 'B'), ], ); }); @@ -299,16 +283,13 @@ void main() { final bSnap = await b.get(); - final querySnap = - await collection.orderByTitle(endAtDocument: bSnap).get(); + final querySnap = await collection.orderByTitle(endAtDocument: bSnap).get(); expect( querySnap.docs, [ - isA() - .having((d) => d.data.title, 'data.title', 'A'), - isA() - .having((d) => d.data.title, 'data.title', 'B'), + isA().having((d) => d.data.title, 'data.title', 'A'), + isA().having((d) => d.data.title, 'data.title', 'B'), ], ); }); @@ -327,10 +308,8 @@ void main() { expect( querySnap.docs, [ - isA() - .having((d) => d.data.title, 'data.title', 'A'), - isA() - .having((d) => d.data.title, 'data.title', 'B'), + isA().having((d) => d.data.title, 'data.title', 'A'), + isA().having((d) => d.data.title, 'data.title', 'B'), ], ); }); @@ -344,14 +323,12 @@ void main() { final bSnap = await b.get(); - final querySnap = - await collection.orderByTitle(endBeforeDocument: bSnap).get(); + final querySnap = await collection.orderByTitle(endBeforeDocument: bSnap).get(); expect( querySnap.docs, [ - isA() - .having((d) => d.data.title, 'data.title', 'A'), + isA().having((d) => d.data.title, 'data.title', 'A'), ], ); }); @@ -455,20 +432,15 @@ void main() { ), ); - final querySnap = await collection - .whereGenre(arrayContains: 'bar') - .orderByTitle() - .get(); + final querySnap = await collection.whereGenre(arrayContains: 'bar').orderByTitle().get(); expect( querySnap.docs.map((e) => e.data.title), ['B', 'C'], ); - final querySnap2 = await collection - .whereTags(arrayContains: 'serious') - .orderByTitle() - .get(); + final querySnap2 = + await collection.whereTags(arrayContains: 'serious').orderByTitle().get(); expect( querySnap2.docs.map((e) => e.data.title), @@ -506,8 +478,7 @@ void main() { await collection.doc('B').set(createMovie(title: 'title')); await collection.doc('C').set(createMovie(title: 'title')); - final querySnap = - await collection.orderByDocumentId(startAt: 'B').get(); + final querySnap = await collection.orderByDocumentId(startAt: 'B').get(); expect( querySnap.docs, @@ -525,8 +496,7 @@ void main() { await collection.doc('B').set(createMovie(title: 'title')); await collection.doc('C').set(createMovie(title: 'title')); - final querySnap = - await collection.whereDocumentId(isEqualTo: 'B').get(); + final querySnap = await collection.whereDocumentId(isEqualTo: 'B').get(); expect( querySnap.docs, @@ -539,15 +509,11 @@ void main() { group('where', () { test('supports field renaming', () async { - final collection = - await initializeTest(AdvancedJsonCollectionReference()); + final collection = await initializeTest(AdvancedJsonCollectionReference()); - await collection - .add(AdvancedJson(firstName: 'John', lastName: 'Doe')); - await collection - .add(AdvancedJson(firstName: 'John', lastName: 'Smith')); - await collection - .add(AdvancedJson(firstName: 'Mike', lastName: 'Doe')); + await collection.add(AdvancedJson(firstName: 'John', lastName: 'Doe')); + await collection.add(AdvancedJson(firstName: 'John', lastName: 'Smith')); + await collection.add(AdvancedJson(firstName: 'Mike', lastName: 'Doe')); expect( await collection.reference @@ -589,16 +555,12 @@ void main() { group('orderBy', () { test('supports field renaming', () async { - final collection = - await initializeTest(AdvancedJsonCollectionReference()); + final collection = await initializeTest(AdvancedJsonCollectionReference()); await collection.add(AdvancedJson(firstName: 'A', lastName: 'A')); - await collection - .add(AdvancedJson(firstName: 'John', lastName: 'Doe')); - await collection - .add(AdvancedJson(firstName: 'John', lastName: 'Smith')); - await collection - .add(AdvancedJson(firstName: 'Mike', lastName: 'Doe')); + await collection.add(AdvancedJson(firstName: 'John', lastName: 'Doe')); + await collection.add(AdvancedJson(firstName: 'John', lastName: 'Smith')); + await collection.add(AdvancedJson(firstName: 'Mike', lastName: 'Doe')); expect( await collection.reference @@ -646,10 +608,8 @@ void main() { expect( querySnap.docs, [ - isA() - .having((d) => d.data.title, 'data.title', 'B'), - isA() - .having((d) => d.data.title, 'data.title', 'C'), + isA().having((d) => d.data.title, 'data.title', 'B'), + isA().having((d) => d.data.title, 'data.title', 'C'), ], ); }, @@ -668,10 +628,8 @@ void main() { await collection.add(createMovie(title: 'C', likes: 1)); await collection.add(createMovie(title: 'C', likes: 2)); - final querySnap = await collection - .orderByTitle(startAt: 'B') - .orderByLikes(startAt: 2) - .get(); + final querySnap = + await collection.orderByTitle(startAt: 'B').orderByLikes(startAt: 2).get(); expect( querySnap.docs, @@ -700,16 +658,13 @@ void main() { final bSnap = await b.get(); - final querySnap = - await collection.orderByTitle(startAtDocument: bSnap).get(); + final querySnap = await collection.orderByTitle(startAtDocument: bSnap).get(); expect( querySnap.docs, [ - isA() - .having((d) => d.data.title, 'data.title', 'B'), - isA() - .having((d) => d.data.title, 'data.title', 'C'), + isA().having((d) => d.data.title, 'data.title', 'B'), + isA().having((d) => d.data.title, 'data.title', 'C'), ], ); }); @@ -723,14 +678,12 @@ void main() { await collection.add(createMovie(title: 'B')); await collection.add(createMovie(title: 'C')); - final querySnap = - await collection.orderByTitle(startAfter: 'B').get(); + final querySnap = await collection.orderByTitle(startAfter: 'B').get(); expect( querySnap.docs, [ - isA() - .having((d) => d.data.title, 'data.title', 'C'), + isA().having((d) => d.data.title, 'data.title', 'C'), ], ); }); @@ -744,14 +697,12 @@ void main() { final bSnap = await b.get(); - final querySnap = - await collection.orderByTitle(startAfterDocument: bSnap).get(); + final querySnap = await collection.orderByTitle(startAfterDocument: bSnap).get(); expect( querySnap.docs, [ - isA() - .having((d) => d.data.title, 'data.title', 'C'), + isA().having((d) => d.data.title, 'data.title', 'C'), ], ); }); @@ -769,10 +720,8 @@ void main() { expect( querySnap.docs, [ - isA() - .having((d) => d.data.title, 'data.title', 'A'), - isA() - .having((d) => d.data.title, 'data.title', 'B'), + isA().having((d) => d.data.title, 'data.title', 'A'), + isA().having((d) => d.data.title, 'data.title', 'B'), ], ); }); @@ -789,10 +738,8 @@ void main() { expect( querySnap.docs, [ - isA() - .having((d) => d.data.title, 'data.title', 'B'), - isA() - .having((d) => d.data.title, 'data.title', 'C'), + isA().having((d) => d.data.title, 'data.title', 'B'), + isA().having((d) => d.data.title, 'data.title', 'C'), ], ); }); @@ -956,9 +903,7 @@ void main() { test('overrides ==', () { expect( MovieCollectionReference().doc('123').comments, - MovieCollectionReference(FirebaseFirestore.instance) - .doc('123') - .comments, + MovieCollectionReference(FirebaseFirestore.instance).doc('123').comments, ); expect( MovieCollectionReference().doc('123').comments, @@ -985,11 +930,10 @@ void main() { await collection.add(Enums(id: 'B', enumValue: TestEnum.two)); await collection.add(Enums(id: 'C', enumValue: TestEnum.two)); - final querySnap = - await collection.whereEnumValue(isEqualTo: TestEnum.two).get(); + final querySnap = await collection.whereEnumValue(isEqualTo: TestEnum.two).get(); expect( - querySnap.docs.map((e) => e.data.id), + (querySnap.docs.map((e) => e.data.id).toList()..sort()), ['B', 'C'], ); }); @@ -1001,12 +945,10 @@ void main() { await collection.add(Enums(id: 'B', nullableEnumValue: TestEnum.two)); await collection.add(Enums(id: 'C', nullableEnumValue: TestEnum.two)); - final querySnap = await collection - .whereNullableEnumValue(isEqualTo: TestEnum.two) - .get(); + final querySnap = await collection.whereNullableEnumValue(isEqualTo: TestEnum.two).get(); expect( - querySnap.docs.map((e) => e.data.id), + (querySnap.docs.map((e) => e.data.id).toList()..sort()), ['B', 'C'], ); }); @@ -1014,18 +956,14 @@ void main() { test('enumList', () async { final collection = await initializeTest(EnumsCollectionReference()); - await collection - .add(Enums(id: 'A', enumList: [TestEnum.one, TestEnum.three])); - await collection - .add(Enums(id: 'B', enumList: [TestEnum.two, TestEnum.three])); - await collection - .add(Enums(id: 'C', enumList: [TestEnum.two, TestEnum.three])); + await collection.add(Enums(id: 'A', enumList: [TestEnum.one, TestEnum.three])); + await collection.add(Enums(id: 'B', enumList: [TestEnum.two, TestEnum.three])); + await collection.add(Enums(id: 'C', enumList: [TestEnum.two, TestEnum.three])); - final querySnap = - await collection.whereEnumList(arrayContains: TestEnum.two).get(); + final querySnap = await collection.whereEnumList(arrayContains: TestEnum.two).get(); expect( - querySnap.docs.map((e) => e.data.id), + (querySnap.docs.map((e) => e.data.id).toList()..sort()), ['B', 'C'], ); }); @@ -1043,12 +981,10 @@ void main() { Enums(id: 'C', nullableEnumList: [TestEnum.two, TestEnum.three]), ); - final querySnap = await collection - .whereNullableEnumList(arrayContains: TestEnum.two) - .get(); + final querySnap = await collection.whereNullableEnumList(arrayContains: TestEnum.two).get(); expect( - querySnap.docs.map((e) => e.data.id), + (querySnap.docs.map((e) => e.data.id).toList()..sort()), ['B', 'C'], ); }); diff --git a/packages/cloud_firestore_odm/example/integration_test/common.dart b/packages/cloud_firestore_odm/example/integration_test/common.dart index c033ef9..be16607 100644 --- a/packages/cloud_firestore_odm/example/integration_test/common.dart +++ b/packages/cloud_firestore_odm/example/integration_test/common.dart @@ -9,8 +9,7 @@ import 'package:cloud_firestore_odm_example/movie.dart'; import 'package:firebase_core/firebase_core.dart'; import 'package:mockito/mockito.dart'; -Future - initializeTest>( +Future initializeTest>( T ref, ) async { final snapshot = await ref.reference.get(); diff --git a/packages/cloud_firestore_odm/example/integration_test/document_reference_test.dart b/packages/cloud_firestore_odm/example/integration_test/document_reference_test.dart index 465faaf..093e409 100644 --- a/packages/cloud_firestore_odm/example/integration_test/document_reference_test.dart +++ b/packages/cloud_firestore_odm/example/integration_test/document_reference_test.dart @@ -137,12 +137,8 @@ void main() { await collection.doc('123').get(); expect( - await collection - .doc('123') - .get(const GetOptions(source: Source.cache)), - isA() - .having((e) => e.data?.title, 'data.title', 'title') - .having( + await collection.doc('123').get(const GetOptions(source: Source.cache)), + isA().having((e) => e.data?.title, 'data.title', 'title').having( (e) => e.metadata.isFromCache, 'metadata.isFromCache', true, @@ -160,6 +156,8 @@ void main() { (transaction) => collection.doc('123').transactionGet(transaction), ); + print('result.data ${result.data}'); + print('result.data ${result.data}'); expect(result.id, '123'); expect(result.data?.title, 'title'); }); @@ -172,8 +170,7 @@ void main() { expect( await stream.next, - isA() - .having((e) => e.exists, 'exists', false), + isA().having((e) => e.exists, 'exists', false), ); await collection.doc('123').set(createMovie(title: 'title')); @@ -256,9 +253,7 @@ void main() { expect( await ref.doc('123').get().then((e) => e.data), - isA() - .having((e) => e.rated, 'rated', '') - .having((e) => e.title, 'title', 'Foo'), + isA().having((e) => e.rated, 'rated', '').having((e) => e.title, 'title', 'Foo'), ); }); }); @@ -286,12 +281,9 @@ void main() { ); }); - test('asserts that we cannot specify both FieldValue and normal value', - () async { + test('asserts that we cannot specify both FieldValue and normal value', () async { expect( - () => moviesRef - .doc('123') - .update(likes: 10, likesFieldValue: FieldValue.increment(10)), + () => moviesRef.doc('123').update(likes: 10, likesFieldValue: FieldValue.increment(10)), throwsAssertionError, ); }); @@ -420,9 +412,7 @@ void main() { }); group('root document reference', () { - test( - 'can make fromJson optional if model is annotated by JsonSerializable', - () async { + test('can make fromJson optional if model is annotated by JsonSerializable', () async { final collection = await initializeTest(optionalJsonRef); await collection.doc('123').set(OptionalJson(42)); @@ -440,10 +430,7 @@ void main() { await collection.doc('123').set(MixedJson(42)); - final rawSnapshot = await FirebaseFirestore.instance - .collection('root') - .doc('123') - .get(); + final rawSnapshot = await FirebaseFirestore.instance.collection('root').doc('123').get(); expect(rawSnapshot.data(), {'foo': 42}); expect( @@ -477,10 +464,7 @@ void main() { test('overrides ==', () { expect( MovieCollectionReference().doc('123').comments.doc('123'), - MovieCollectionReference(FirebaseFirestore.instance) - .doc('123') - .comments - .doc('123'), + MovieCollectionReference(FirebaseFirestore.instance).doc('123').comments.doc('123'), ); expect( MovieCollectionReference().doc('123').comments.doc('123'), @@ -492,21 +476,12 @@ void main() { ); expect( - MovieCollectionReference(customFirestore) - .doc('123') - .comments - .doc('123'), + MovieCollectionReference(customFirestore).doc('123').comments.doc('123'), isNot(MovieCollectionReference().doc('123').comments.doc('123')), ); expect( - MovieCollectionReference(customFirestore) - .doc('123') - .comments - .doc('123'), - MovieCollectionReference(customFirestore) - .doc('123') - .comments - .doc('123'), + MovieCollectionReference(customFirestore).doc('123').comments.doc('123'), + MovieCollectionReference(customFirestore).doc('123').comments.doc('123'), ); }); }); diff --git a/packages/cloud_firestore_odm/example/integration_test/firestore_builder_test.dart b/packages/cloud_firestore_odm/example/integration_test/firestore_builder_test.dart index 0e83f66..9b6611e 100644 --- a/packages/cloud_firestore_odm/example/integration_test/firestore_builder_test.dart +++ b/packages/cloud_firestore_odm/example/integration_test/firestore_builder_test.dart @@ -23,8 +23,7 @@ void main() { return ListView( children: [ - for (final doc in snapshot.requireData.docs) - Text(doc.data.title), + for (final doc in snapshot.requireData.docs) Text(doc.data.title), ], ); }, @@ -49,7 +48,7 @@ void main() { ); } - group('$FirestoreBuilder', () { + group('FirestoreBuilder', () { testWidgets('listens to documents', (tester) async { final collection = await initializeTest(MovieCollectionReference()); @@ -69,8 +68,7 @@ void main() { expect(find.text('Foo'), findsOneWidget); }); - testWidgets('emits errored snapshot when failed to decode a value', - (tester) async { + testWidgets('emits errored snapshot when failed to decode a value', (tester) async { final collection = await initializeTest(MovieCollectionReference()); await FirebaseFirestore.instance @@ -146,8 +144,7 @@ void main() { expect(find.text('A'), findsOneWidget); expect(find.text('B'), findsOneWidget); }); - testWidgets( - 'does not go back to loading if rebuilding the widget with the same query', + testWidgets('does not go back to loading if rebuilding the widget with the same query', (tester) async { final collection = await initializeTest(MovieCollectionReference()); diff --git a/packages/cloud_firestore_odm/example/integration_test/freezed_test.dart b/packages/cloud_firestore_odm/example/integration_test/freezed_test.dart index 461202b..faed47d 100644 --- a/packages/cloud_firestore_odm/example/integration_test/freezed_test.dart +++ b/packages/cloud_firestore_odm/example/integration_test/freezed_test.dart @@ -2,12 +2,21 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. +import 'package:cloud_firestore/cloud_firestore.dart'; import 'package:cloud_firestore_odm_example/integration/freezed.dart'; +import 'package:firebase_core/firebase_core.dart'; import 'package:flutter_test/flutter_test.dart'; import 'common.dart'; +import 'firebase_options.dart'; void main() { + setUpAll(() async { + await Firebase.initializeApp( + options: DefaultFirebaseOptions.currentPlatform, + ); + FirebaseFirestore.instance.useFirestoreEmulator('localhost', 8080); + }); test('supports field renaming', () async { final collection = await initializeTest(PersonCollectionReference()); @@ -55,12 +64,13 @@ void main() { await aRef.update(firstName: 'A2', lastName: 'B2'); expect( - await aRef.reference - .withConverter>( - fromFirestore: (value, _) => value.data()!, - toFirestore: (value, _) => value, - ) - .get(), + (await aRef.reference + .withConverter>( + fromFirestore: (value, _) => value.data()!, + toFirestore: (value, _) => value, + ) + .get()) + .data(), { 'first_name': 'A2', 'LAST_NAME': 'B2', diff --git a/packages/cloud_firestore_odm/example/integration_test/path_test.dart b/packages/cloud_firestore_odm/example/integration_test/path_test.dart index cf4650f..fadcc03 100644 --- a/packages/cloud_firestore_odm/example/integration_test/path_test.dart +++ b/packages/cloud_firestore_odm/example/integration_test/path_test.dart @@ -21,8 +21,7 @@ void main() { final snapshot = await collection.get(); expect(snapshot.docs, [ - isA() - .having((e) => e.data.value, 'data.value', 42), + isA().having((e) => e.data.value, 'data.value', 42), ]); }); @@ -36,8 +35,7 @@ void main() { final snapshot = await collection.get(); expect(snapshot.docs, [ - isA() - .having((e) => e.data.value, 'data.value', 42), + isA().having((e) => e.data.value, 'data.value', 42), ]); }); }); @@ -53,15 +51,12 @@ void main() { final snapshot = await collection.get(); expect(snapshot.docs, [ - isA() - .having((e) => e.data.value, 'data.value', 42), + isA().having((e) => e.data.value, 'data.value', 42), ]); }); - test('can be manually specified through the Collection annotation', - () async { - final collection = - await initializeTest(rootRef.doc('123').thisIsACustomName); + test('can be manually specified through the Collection annotation', () async { + final collection = await initializeTest(rootRef.doc('123').thisIsACustomName); await FirebaseFirestore.instance .collection('root/123/custom-sub-name') @@ -70,18 +65,15 @@ void main() { final snapshot = await collection.get(); expect(snapshot.docs, [ - isA() - .having((e) => e.data.value, 'data.value', 42), + isA().having((e) => e.data.value, 'data.value', 42), ]); }); }); }); group('collection class prefix', () { - test('can be manually specified through the Collection annotation', - () async { - final collection = - await initializeTest(rootRef.doc('123').customClassPrefix); + test('can be manually specified through the Collection annotation', () async { + final collection = await initializeTest(rootRef.doc('123').customClassPrefix); await FirebaseFirestore.instance .collection('root/123/custom-class-prefix') @@ -90,8 +82,7 @@ void main() { final snapshot = await collection.get(); expect(snapshot.docs, [ - isA() - .having((e) => e.data?.value, 'data.value', 42), + isA().having((e) => e.data?.value, 'data.value', 42), ]); }); }); diff --git a/packages/cloud_firestore_odm/example/integration_test/query_reference_test.dart b/packages/cloud_firestore_odm/example/integration_test/query_reference_test.dart index 9426839..19b6a14 100644 --- a/packages/cloud_firestore_odm/example/integration_test/query_reference_test.dart +++ b/packages/cloud_firestore_odm/example/integration_test/query_reference_test.dart @@ -58,10 +58,7 @@ void main() { test('overrides ==', () { expect( MovieCollectionReference().doc('123').comments.limit(1), - MovieCollectionReference(FirebaseFirestore.instance) - .doc('123') - .comments - .limit(1), + MovieCollectionReference(FirebaseFirestore.instance).doc('123').comments.limit(1), ); expect( MovieCollectionReference().doc('123').comments.limit(1), @@ -73,21 +70,12 @@ void main() { ); expect( - MovieCollectionReference(customFirestore) - .doc('123') - .comments - .limit(1), + MovieCollectionReference(customFirestore).doc('123').comments.limit(1), isNot(MovieCollectionReference().doc('123').comments.limit(1)), ); expect( - MovieCollectionReference(customFirestore) - .doc('123') - .comments - .limit(1), - MovieCollectionReference(customFirestore) - .doc('123') - .comments - .limit(1), + MovieCollectionReference(customFirestore).doc('123').comments.limit(1), + MovieCollectionReference(customFirestore).doc('123').comments.limit(1), ); }); }); @@ -99,8 +87,7 @@ void main() { await ref.add(DurationQuery(const Duration(days: 2))); await ref.add(DurationQuery(const Duration(days: 3))); - final snapshot = - await ref.orderByDuration(startAt: const Duration(days: 2)).get(); + final snapshot = await ref.orderByDuration(startAt: const Duration(days: 2)).get(); expect(snapshot.docs.length, 2); @@ -130,9 +117,7 @@ void main() { await ref.add(TimestampQuery(Timestamp.fromDate(DateTime(2000)))); await ref.add(TimestampQuery(Timestamp.fromDate(DateTime(2010)))); - final snapshot = await ref - .orderByTime(startAt: Timestamp.fromDate(DateTime(2000))) - .get(); + final snapshot = await ref.orderByTime(startAt: Timestamp.fromDate(DateTime(2000))).get(); expect(snapshot.docs.length, 2); @@ -147,8 +132,7 @@ void main() { await ref.add(GeoPointQuery(const GeoPoint(20, 0))); await ref.add(GeoPointQuery(const GeoPoint(20, 0))); - final snapshot = - await ref.orderByPoint(startAt: const GeoPoint(20, 0)).get(); + final snapshot = await ref.orderByPoint(startAt: const GeoPoint(20, 0)).get(); expect(snapshot.docs.length, 2); @@ -171,9 +155,8 @@ void main() { DocumentReferenceQuery(FirebaseFirestore.instance.doc('foo/c')), ); - final snapshot = await ref - .orderByRef(startAt: FirebaseFirestore.instance.doc('foo/b')) - .get(); + final snapshot = + await ref.orderByRef(startAt: FirebaseFirestore.instance.doc('foo/b')).get(); expect(snapshot.docs.length, 2); @@ -217,6 +200,8 @@ void main() { snapshot.docs.map((document) => document.data.number), everyElement(anyOf(1, 2, 3)), ); - }); + }, + skip: + 'FirebaseError: Tried to deserialize key from different project: react-native-firebase-testing vs flutterfire-e2e-tests'); }); } diff --git a/packages/cloud_firestore_odm/example/lib/integration.g.dart b/packages/cloud_firestore_odm/example/lib/integration.g.dart index 71f4646..3ad08ff 100644 --- a/packages/cloud_firestore_odm/example/lib/integration.g.dart +++ b/packages/cloud_firestore_odm/example/lib/integration.g.dart @@ -272,7 +272,11 @@ class _$AdvancedJsonDocumentReference extends FirestoreDocumentReference< _$AdvancedJsonFieldMap['lastName']!: lastNameFieldValue, }; - transaction.set(reference, json, options); + final castedReference = reference.withConverter>( + fromFirestore: (snapshot, options) => throw UnimplementedError(), + toFirestore: (value, options) => value, + ); + transaction.set(castedReference, json, options); } void batchSet( @@ -290,7 +294,11 @@ class _$AdvancedJsonDocumentReference extends FirestoreDocumentReference< _$AdvancedJsonFieldMap['lastName']!: lastNameFieldValue, }; - batch.set(reference, json, options); + final castedReference = reference.withConverter>( + fromFirestore: (snapshot, options) => throw UnimplementedError(), + toFirestore: (value, options) => value, + ); + batch.set(castedReference, json, options); } Future update({ @@ -942,25 +950,37 @@ class _$AdvancedJsonQuery if (startAt != _sentinel) { queryCursor = queryCursor.copyWith( - startAt: [...queryCursor.startAt, startAt], + startAt: [ + ...queryCursor.startAt, + _$AdvancedJsonPerFieldToJson.firstName(startAt as String?) + ], startAtDocumentSnapshot: null, ); } if (startAfter != _sentinel) { queryCursor = queryCursor.copyWith( - startAfter: [...queryCursor.startAfter, startAfter], + startAfter: [ + ...queryCursor.startAfter, + _$AdvancedJsonPerFieldToJson.firstName(startAfter as String?) + ], startAfterDocumentSnapshot: null, ); } if (endAt != _sentinel) { queryCursor = queryCursor.copyWith( - endAt: [...queryCursor.endAt, endAt], + endAt: [ + ...queryCursor.endAt, + _$AdvancedJsonPerFieldToJson.firstName(endAt as String?) + ], endAtDocumentSnapshot: null, ); } if (endBefore != _sentinel) { queryCursor = queryCursor.copyWith( - endBefore: [...queryCursor.endBefore, endBefore], + endBefore: [ + ...queryCursor.endBefore, + _$AdvancedJsonPerFieldToJson.firstName(endBefore as String?) + ], endBeforeDocumentSnapshot: null, ); } @@ -1015,25 +1035,37 @@ class _$AdvancedJsonQuery if (startAt != _sentinel) { queryCursor = queryCursor.copyWith( - startAt: [...queryCursor.startAt, startAt], + startAt: [ + ...queryCursor.startAt, + _$AdvancedJsonPerFieldToJson.lastName(startAt as String?) + ], startAtDocumentSnapshot: null, ); } if (startAfter != _sentinel) { queryCursor = queryCursor.copyWith( - startAfter: [...queryCursor.startAfter, startAfter], + startAfter: [ + ...queryCursor.startAfter, + _$AdvancedJsonPerFieldToJson.lastName(startAfter as String?) + ], startAfterDocumentSnapshot: null, ); } if (endAt != _sentinel) { queryCursor = queryCursor.copyWith( - endAt: [...queryCursor.endAt, endAt], + endAt: [ + ...queryCursor.endAt, + _$AdvancedJsonPerFieldToJson.lastName(endAt as String?) + ], endAtDocumentSnapshot: null, ); } if (endBefore != _sentinel) { queryCursor = queryCursor.copyWith( - endBefore: [...queryCursor.endBefore, endBefore], + endBefore: [ + ...queryCursor.endBefore, + _$AdvancedJsonPerFieldToJson.lastName(endBefore as String?) + ], endBeforeDocumentSnapshot: null, ); } @@ -1406,7 +1438,11 @@ class _$_PrivateAdvancedJsonDocumentReference _$PrivateAdvancedJsonFieldMap['lastName']!: lastNameFieldValue, }; - transaction.set(reference, json, options); + final castedReference = reference.withConverter>( + fromFirestore: (snapshot, options) => throw UnimplementedError(), + toFirestore: (value, options) => value, + ); + transaction.set(castedReference, json, options); } void batchSet( @@ -1424,7 +1460,11 @@ class _$_PrivateAdvancedJsonDocumentReference _$PrivateAdvancedJsonFieldMap['lastName']!: lastNameFieldValue, }; - batch.set(reference, json, options); + final castedReference = reference.withConverter>( + fromFirestore: (snapshot, options) => throw UnimplementedError(), + toFirestore: (value, options) => value, + ); + batch.set(castedReference, json, options); } Future update({ @@ -2088,25 +2128,37 @@ class _$_PrivateAdvancedJsonQuery extends QueryReference<_PrivateAdvancedJson, if (startAt != _sentinel) { queryCursor = queryCursor.copyWith( - startAt: [...queryCursor.startAt, startAt], + startAt: [ + ...queryCursor.startAt, + _$PrivateAdvancedJsonPerFieldToJson.firstName(startAt as String?) + ], startAtDocumentSnapshot: null, ); } if (startAfter != _sentinel) { queryCursor = queryCursor.copyWith( - startAfter: [...queryCursor.startAfter, startAfter], + startAfter: [ + ...queryCursor.startAfter, + _$PrivateAdvancedJsonPerFieldToJson.firstName(startAfter as String?) + ], startAfterDocumentSnapshot: null, ); } if (endAt != _sentinel) { queryCursor = queryCursor.copyWith( - endAt: [...queryCursor.endAt, endAt], + endAt: [ + ...queryCursor.endAt, + _$PrivateAdvancedJsonPerFieldToJson.firstName(endAt as String?) + ], endAtDocumentSnapshot: null, ); } if (endBefore != _sentinel) { queryCursor = queryCursor.copyWith( - endBefore: [...queryCursor.endBefore, endBefore], + endBefore: [ + ...queryCursor.endBefore, + _$PrivateAdvancedJsonPerFieldToJson.firstName(endBefore as String?) + ], endBeforeDocumentSnapshot: null, ); } @@ -2162,25 +2214,37 @@ class _$_PrivateAdvancedJsonQuery extends QueryReference<_PrivateAdvancedJson, if (startAt != _sentinel) { queryCursor = queryCursor.copyWith( - startAt: [...queryCursor.startAt, startAt], + startAt: [ + ...queryCursor.startAt, + _$PrivateAdvancedJsonPerFieldToJson.lastName(startAt as String?) + ], startAtDocumentSnapshot: null, ); } if (startAfter != _sentinel) { queryCursor = queryCursor.copyWith( - startAfter: [...queryCursor.startAfter, startAfter], + startAfter: [ + ...queryCursor.startAfter, + _$PrivateAdvancedJsonPerFieldToJson.lastName(startAfter as String?) + ], startAfterDocumentSnapshot: null, ); } if (endAt != _sentinel) { queryCursor = queryCursor.copyWith( - endAt: [...queryCursor.endAt, endAt], + endAt: [ + ...queryCursor.endAt, + _$PrivateAdvancedJsonPerFieldToJson.lastName(endAt as String?) + ], endAtDocumentSnapshot: null, ); } if (endBefore != _sentinel) { queryCursor = queryCursor.copyWith( - endBefore: [...queryCursor.endBefore, endBefore], + endBefore: [ + ...queryCursor.endBefore, + _$PrivateAdvancedJsonPerFieldToJson.lastName(endBefore as String?) + ], endBeforeDocumentSnapshot: null, ); } diff --git a/packages/cloud_firestore_odm/example/lib/integration/enums.g.dart b/packages/cloud_firestore_odm/example/lib/integration/enums.g.dart index 6946dff..20a9ff6 100644 --- a/packages/cloud_firestore_odm/example/lib/integration/enums.g.dart +++ b/packages/cloud_firestore_odm/example/lib/integration/enums.g.dart @@ -312,7 +312,11 @@ class _$EnumsDocumentReference _$EnumsFieldMap['nullableEnumList']!: nullableEnumListFieldValue, }; - transaction.set(reference, json, options); + final castedReference = reference.withConverter>( + fromFirestore: (snapshot, options) => throw UnimplementedError(), + toFirestore: (value, options) => value, + ); + transaction.set(castedReference, json, options); } void batchSet( @@ -338,7 +342,11 @@ class _$EnumsDocumentReference _$EnumsFieldMap['nullableEnumList']!: nullableEnumListFieldValue, }; - batch.set(reference, json, options); + final castedReference = reference.withConverter>( + fromFirestore: (snapshot, options) => throw UnimplementedError(), + toFirestore: (value, options) => value, + ); + batch.set(castedReference, json, options); } Future update({ @@ -1303,25 +1311,37 @@ class _$EnumsQuery extends QueryReference if (startAt != _sentinel) { queryCursor = queryCursor.copyWith( - startAt: [...queryCursor.startAt, startAt], + startAt: [ + ...queryCursor.startAt, + _$EnumsPerFieldToJson.id(startAt as String) + ], startAtDocumentSnapshot: null, ); } if (startAfter != _sentinel) { queryCursor = queryCursor.copyWith( - startAfter: [...queryCursor.startAfter, startAfter], + startAfter: [ + ...queryCursor.startAfter, + _$EnumsPerFieldToJson.id(startAfter as String) + ], startAfterDocumentSnapshot: null, ); } if (endAt != _sentinel) { queryCursor = queryCursor.copyWith( - endAt: [...queryCursor.endAt, endAt], + endAt: [ + ...queryCursor.endAt, + _$EnumsPerFieldToJson.id(endAt as String) + ], endAtDocumentSnapshot: null, ); } if (endBefore != _sentinel) { queryCursor = queryCursor.copyWith( - endBefore: [...queryCursor.endBefore, endBefore], + endBefore: [ + ...queryCursor.endBefore, + _$EnumsPerFieldToJson.id(endBefore as String) + ], endBeforeDocumentSnapshot: null, ); } @@ -1376,25 +1396,37 @@ class _$EnumsQuery extends QueryReference if (startAt != _sentinel) { queryCursor = queryCursor.copyWith( - startAt: [...queryCursor.startAt, startAt], + startAt: [ + ...queryCursor.startAt, + _$EnumsPerFieldToJson.enumValue(startAt as TestEnum) + ], startAtDocumentSnapshot: null, ); } if (startAfter != _sentinel) { queryCursor = queryCursor.copyWith( - startAfter: [...queryCursor.startAfter, startAfter], + startAfter: [ + ...queryCursor.startAfter, + _$EnumsPerFieldToJson.enumValue(startAfter as TestEnum) + ], startAfterDocumentSnapshot: null, ); } if (endAt != _sentinel) { queryCursor = queryCursor.copyWith( - endAt: [...queryCursor.endAt, endAt], + endAt: [ + ...queryCursor.endAt, + _$EnumsPerFieldToJson.enumValue(endAt as TestEnum) + ], endAtDocumentSnapshot: null, ); } if (endBefore != _sentinel) { queryCursor = queryCursor.copyWith( - endBefore: [...queryCursor.endBefore, endBefore], + endBefore: [ + ...queryCursor.endBefore, + _$EnumsPerFieldToJson.enumValue(endBefore as TestEnum) + ], endBeforeDocumentSnapshot: null, ); } @@ -1449,25 +1481,37 @@ class _$EnumsQuery extends QueryReference if (startAt != _sentinel) { queryCursor = queryCursor.copyWith( - startAt: [...queryCursor.startAt, startAt], + startAt: [ + ...queryCursor.startAt, + _$EnumsPerFieldToJson.nullableEnumValue(startAt as TestEnum?) + ], startAtDocumentSnapshot: null, ); } if (startAfter != _sentinel) { queryCursor = queryCursor.copyWith( - startAfter: [...queryCursor.startAfter, startAfter], + startAfter: [ + ...queryCursor.startAfter, + _$EnumsPerFieldToJson.nullableEnumValue(startAfter as TestEnum?) + ], startAfterDocumentSnapshot: null, ); } if (endAt != _sentinel) { queryCursor = queryCursor.copyWith( - endAt: [...queryCursor.endAt, endAt], + endAt: [ + ...queryCursor.endAt, + _$EnumsPerFieldToJson.nullableEnumValue(endAt as TestEnum?) + ], endAtDocumentSnapshot: null, ); } if (endBefore != _sentinel) { queryCursor = queryCursor.copyWith( - endBefore: [...queryCursor.endBefore, endBefore], + endBefore: [ + ...queryCursor.endBefore, + _$EnumsPerFieldToJson.nullableEnumValue(endBefore as TestEnum?) + ], endBeforeDocumentSnapshot: null, ); } @@ -1522,25 +1566,37 @@ class _$EnumsQuery extends QueryReference if (startAt != _sentinel) { queryCursor = queryCursor.copyWith( - startAt: [...queryCursor.startAt, startAt], + startAt: [ + ...queryCursor.startAt, + _$EnumsPerFieldToJson.enumList(startAt as List) + ], startAtDocumentSnapshot: null, ); } if (startAfter != _sentinel) { queryCursor = queryCursor.copyWith( - startAfter: [...queryCursor.startAfter, startAfter], + startAfter: [ + ...queryCursor.startAfter, + _$EnumsPerFieldToJson.enumList(startAfter as List) + ], startAfterDocumentSnapshot: null, ); } if (endAt != _sentinel) { queryCursor = queryCursor.copyWith( - endAt: [...queryCursor.endAt, endAt], + endAt: [ + ...queryCursor.endAt, + _$EnumsPerFieldToJson.enumList(endAt as List) + ], endAtDocumentSnapshot: null, ); } if (endBefore != _sentinel) { queryCursor = queryCursor.copyWith( - endBefore: [...queryCursor.endBefore, endBefore], + endBefore: [ + ...queryCursor.endBefore, + _$EnumsPerFieldToJson.enumList(endBefore as List) + ], endBeforeDocumentSnapshot: null, ); } @@ -1595,25 +1651,37 @@ class _$EnumsQuery extends QueryReference if (startAt != _sentinel) { queryCursor = queryCursor.copyWith( - startAt: [...queryCursor.startAt, startAt], + startAt: [ + ...queryCursor.startAt, + _$EnumsPerFieldToJson.nullableEnumList(startAt as List?) + ], startAtDocumentSnapshot: null, ); } if (startAfter != _sentinel) { queryCursor = queryCursor.copyWith( - startAfter: [...queryCursor.startAfter, startAfter], + startAfter: [ + ...queryCursor.startAfter, + _$EnumsPerFieldToJson.nullableEnumList(startAfter as List?) + ], startAfterDocumentSnapshot: null, ); } if (endAt != _sentinel) { queryCursor = queryCursor.copyWith( - endAt: [...queryCursor.endAt, endAt], + endAt: [ + ...queryCursor.endAt, + _$EnumsPerFieldToJson.nullableEnumList(endAt as List?) + ], endAtDocumentSnapshot: null, ); } if (endBefore != _sentinel) { queryCursor = queryCursor.copyWith( - endBefore: [...queryCursor.endBefore, endBefore], + endBefore: [ + ...queryCursor.endBefore, + _$EnumsPerFieldToJson.nullableEnumList(endBefore as List?) + ], endBeforeDocumentSnapshot: null, ); } diff --git a/packages/cloud_firestore_odm/example/lib/integration/freezed.freezed.dart b/packages/cloud_firestore_odm/example/lib/integration/freezed.freezed.dart index aa734d6..cbe46b2 100644 --- a/packages/cloud_firestore_odm/example/lib/integration/freezed.freezed.dart +++ b/packages/cloud_firestore_odm/example/lib/integration/freezed.freezed.dart @@ -1,6 +1,5 @@ -// dart format width=80 -// coverage:ignore-file // GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file // ignore_for_file: type=lint // ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark @@ -97,6 +96,177 @@ class _$PersonCopyWithImpl<$Res> implements $PersonCopyWith<$Res> { } } +/// Adds pattern-matching-related methods to [Person]. +extension PersonPatterns on Person { + /// A variant of `map` that fallback to returning `orElse`. + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case final Subclass value: + /// return ...; + /// case _: + /// return orElse(); + /// } + /// ``` + + @optionalTypeArgs + TResult maybeMap( + TResult Function(_Person value)? $default, { + required TResult orElse(), + }) { + final _that = this; + switch (_that) { + case _Person() when $default != null: + return $default(_that); + case _: + return orElse(); + } + } + + /// A `switch`-like method, using callbacks. + /// + /// Callbacks receives the raw object, upcasted. + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case final Subclass value: + /// return ...; + /// case final Subclass2 value: + /// return ...; + /// } + /// ``` + + @optionalTypeArgs + TResult map( + TResult Function(_Person value) $default, + ) { + final _that = this; + switch (_that) { + case _Person(): + return $default(_that); + case _: + throw StateError('Unexpected subclass'); + } + } + + /// A variant of `map` that fallback to returning `null`. + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case final Subclass value: + /// return ...; + /// case _: + /// return null; + /// } + /// ``` + + @optionalTypeArgs + TResult? mapOrNull( + TResult? Function(_Person value)? $default, + ) { + final _that = this; + switch (_that) { + case _Person() when $default != null: + return $default(_that); + case _: + return null; + } + } + + /// A variant of `when` that fallback to an `orElse` callback. + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case Subclass(:final field): + /// return ...; + /// case _: + /// return orElse(); + /// } + /// ``` + + @optionalTypeArgs + TResult maybeWhen( + TResult Function( + String firstName, + @JsonKey(name: 'LAST_NAME') String lastName, + @JsonKey(includeFromJson: false, includeToJson: false) + int? ignored)? + $default, { + required TResult orElse(), + }) { + final _that = this; + switch (_that) { + case _Person() when $default != null: + return $default(_that.firstName, _that.lastName, _that.ignored); + case _: + return orElse(); + } + } + + /// A `switch`-like method, using callbacks. + /// + /// As opposed to `map`, this offers destructuring. + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case Subclass(:final field): + /// return ...; + /// case Subclass2(:final field2): + /// return ...; + /// } + /// ``` + + @optionalTypeArgs + TResult when( + TResult Function( + String firstName, + @JsonKey(name: 'LAST_NAME') String lastName, + @JsonKey(includeFromJson: false, includeToJson: false) int? ignored) + $default, + ) { + final _that = this; + switch (_that) { + case _Person(): + return $default(_that.firstName, _that.lastName, _that.ignored); + case _: + throw StateError('Unexpected subclass'); + } + } + + /// A variant of `when` that fallback to returning `null` + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case Subclass(:final field): + /// return ...; + /// case _: + /// return null; + /// } + /// ``` + + @optionalTypeArgs + TResult? whenOrNull( + TResult? Function( + String firstName, + @JsonKey(name: 'LAST_NAME') String lastName, + @JsonKey(includeFromJson: false, includeToJson: false) + int? ignored)? + $default, + ) { + final _that = this; + switch (_that) { + case _Person() when $default != null: + return $default(_that.firstName, _that.lastName, _that.ignored); + case _: + return null; + } + } +} + /// @nodoc @JsonSerializable(fieldRename: FieldRename.snake) @@ -268,6 +438,163 @@ class _$PublicRedirectedCopyWithImpl<$Res> } } +/// Adds pattern-matching-related methods to [PublicRedirected]. +extension PublicRedirectedPatterns on PublicRedirected { + /// A variant of `map` that fallback to returning `orElse`. + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case final Subclass value: + /// return ...; + /// case _: + /// return orElse(); + /// } + /// ``` + + @optionalTypeArgs + TResult maybeMap( + TResult Function(PublicRedirected2 value)? $default, { + required TResult orElse(), + }) { + final _that = this; + switch (_that) { + case PublicRedirected2() when $default != null: + return $default(_that); + case _: + return orElse(); + } + } + + /// A `switch`-like method, using callbacks. + /// + /// Callbacks receives the raw object, upcasted. + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case final Subclass value: + /// return ...; + /// case final Subclass2 value: + /// return ...; + /// } + /// ``` + + @optionalTypeArgs + TResult map( + TResult Function(PublicRedirected2 value) $default, + ) { + final _that = this; + switch (_that) { + case PublicRedirected2(): + return $default(_that); + case _: + throw StateError('Unexpected subclass'); + } + } + + /// A variant of `map` that fallback to returning `null`. + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case final Subclass value: + /// return ...; + /// case _: + /// return null; + /// } + /// ``` + + @optionalTypeArgs + TResult? mapOrNull( + TResult? Function(PublicRedirected2 value)? $default, + ) { + final _that = this; + switch (_that) { + case PublicRedirected2() when $default != null: + return $default(_that); + case _: + return null; + } + } + + /// A variant of `when` that fallback to an `orElse` callback. + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case Subclass(:final field): + /// return ...; + /// case _: + /// return orElse(); + /// } + /// ``` + + @optionalTypeArgs + TResult maybeWhen( + TResult Function(String value)? $default, { + required TResult orElse(), + }) { + final _that = this; + switch (_that) { + case PublicRedirected2() when $default != null: + return $default(_that.value); + case _: + return orElse(); + } + } + + /// A `switch`-like method, using callbacks. + /// + /// As opposed to `map`, this offers destructuring. + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case Subclass(:final field): + /// return ...; + /// case Subclass2(:final field2): + /// return ...; + /// } + /// ``` + + @optionalTypeArgs + TResult when( + TResult Function(String value) $default, + ) { + final _that = this; + switch (_that) { + case PublicRedirected2(): + return $default(_that.value); + case _: + throw StateError('Unexpected subclass'); + } + } + + /// A variant of `when` that fallback to returning `null` + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case Subclass(:final field): + /// return ...; + /// case _: + /// return null; + /// } + /// ``` + + @optionalTypeArgs + TResult? whenOrNull( + TResult? Function(String value)? $default, + ) { + final _that = this; + switch (_that) { + case PublicRedirected2() when $default != null: + return $default(_that.value); + case _: + return null; + } + } +} + /// @nodoc @JsonSerializable() class PublicRedirected2 implements PublicRedirected { diff --git a/packages/cloud_firestore_odm/example/lib/integration/freezed.g.dart b/packages/cloud_firestore_odm/example/lib/integration/freezed.g.dart index 8cbddce..87b2361 100644 --- a/packages/cloud_firestore_odm/example/lib/integration/freezed.g.dart +++ b/packages/cloud_firestore_odm/example/lib/integration/freezed.g.dart @@ -269,7 +269,11 @@ class _$PersonDocumentReference _$PersonFieldMap['lastName']!: lastNameFieldValue, }; - transaction.set(reference, json, options); + final castedReference = reference.withConverter>( + fromFirestore: (snapshot, options) => throw UnimplementedError(), + toFirestore: (value, options) => value, + ); + transaction.set(castedReference, json, options); } void batchSet( @@ -287,7 +291,11 @@ class _$PersonDocumentReference _$PersonFieldMap['lastName']!: lastNameFieldValue, }; - batch.set(reference, json, options); + final castedReference = reference.withConverter>( + fromFirestore: (snapshot, options) => throw UnimplementedError(), + toFirestore: (value, options) => value, + ); + batch.set(castedReference, json, options); } Future update({ @@ -928,25 +936,37 @@ class _$PersonQuery extends QueryReference if (startAt != _sentinel) { queryCursor = queryCursor.copyWith( - startAt: [...queryCursor.startAt, startAt], + startAt: [ + ...queryCursor.startAt, + _$PersonPerFieldToJson.firstName(startAt as String) + ], startAtDocumentSnapshot: null, ); } if (startAfter != _sentinel) { queryCursor = queryCursor.copyWith( - startAfter: [...queryCursor.startAfter, startAfter], + startAfter: [ + ...queryCursor.startAfter, + _$PersonPerFieldToJson.firstName(startAfter as String) + ], startAfterDocumentSnapshot: null, ); } if (endAt != _sentinel) { queryCursor = queryCursor.copyWith( - endAt: [...queryCursor.endAt, endAt], + endAt: [ + ...queryCursor.endAt, + _$PersonPerFieldToJson.firstName(endAt as String) + ], endAtDocumentSnapshot: null, ); } if (endBefore != _sentinel) { queryCursor = queryCursor.copyWith( - endBefore: [...queryCursor.endBefore, endBefore], + endBefore: [ + ...queryCursor.endBefore, + _$PersonPerFieldToJson.firstName(endBefore as String) + ], endBeforeDocumentSnapshot: null, ); } @@ -1001,25 +1021,37 @@ class _$PersonQuery extends QueryReference if (startAt != _sentinel) { queryCursor = queryCursor.copyWith( - startAt: [...queryCursor.startAt, startAt], + startAt: [ + ...queryCursor.startAt, + _$PersonPerFieldToJson.lastName(startAt as String) + ], startAtDocumentSnapshot: null, ); } if (startAfter != _sentinel) { queryCursor = queryCursor.copyWith( - startAfter: [...queryCursor.startAfter, startAfter], + startAfter: [ + ...queryCursor.startAfter, + _$PersonPerFieldToJson.lastName(startAfter as String) + ], startAfterDocumentSnapshot: null, ); } if (endAt != _sentinel) { queryCursor = queryCursor.copyWith( - endAt: [...queryCursor.endAt, endAt], + endAt: [ + ...queryCursor.endAt, + _$PersonPerFieldToJson.lastName(endAt as String) + ], endAtDocumentSnapshot: null, ); } if (endBefore != _sentinel) { queryCursor = queryCursor.copyWith( - endBefore: [...queryCursor.endBefore, endBefore], + endBefore: [ + ...queryCursor.endBefore, + _$PersonPerFieldToJson.lastName(endBefore as String) + ], endBeforeDocumentSnapshot: null, ); } @@ -1366,7 +1398,11 @@ class _$PublicRedirectedDocumentReference extends FirestoreDocumentReference< _$PublicRedirected2FieldMap['value']!: valueFieldValue, }; - transaction.set(reference, json, options); + final castedReference = reference.withConverter>( + fromFirestore: (snapshot, options) => throw UnimplementedError(), + toFirestore: (value, options) => value, + ); + transaction.set(castedReference, json, options); } void batchSet( @@ -1381,7 +1417,11 @@ class _$PublicRedirectedDocumentReference extends FirestoreDocumentReference< _$PublicRedirected2FieldMap['value']!: valueFieldValue, }; - batch.set(reference, json, options); + final castedReference = reference.withConverter>( + fromFirestore: (snapshot, options) => throw UnimplementedError(), + toFirestore: (value, options) => value, + ); + batch.set(castedReference, json, options); } Future update({ @@ -1930,25 +1970,37 @@ class _$PublicRedirectedQuery if (startAt != _sentinel) { queryCursor = queryCursor.copyWith( - startAt: [...queryCursor.startAt, startAt], + startAt: [ + ...queryCursor.startAt, + _$PublicRedirected2PerFieldToJson.value(startAt as String) + ], startAtDocumentSnapshot: null, ); } if (startAfter != _sentinel) { queryCursor = queryCursor.copyWith( - startAfter: [...queryCursor.startAfter, startAfter], + startAfter: [ + ...queryCursor.startAfter, + _$PublicRedirected2PerFieldToJson.value(startAfter as String) + ], startAfterDocumentSnapshot: null, ); } if (endAt != _sentinel) { queryCursor = queryCursor.copyWith( - endAt: [...queryCursor.endAt, endAt], + endAt: [ + ...queryCursor.endAt, + _$PublicRedirected2PerFieldToJson.value(endAt as String) + ], endAtDocumentSnapshot: null, ); } if (endBefore != _sentinel) { queryCursor = queryCursor.copyWith( - endBefore: [...queryCursor.endBefore, endBefore], + endBefore: [ + ...queryCursor.endBefore, + _$PublicRedirected2PerFieldToJson.value(endBefore as String) + ], endBeforeDocumentSnapshot: null, ); } diff --git a/packages/cloud_firestore_odm/example/lib/integration/named_query.g.dart b/packages/cloud_firestore_odm/example/lib/integration/named_query.g.dart index 0b91d2f..c5dee3e 100644 --- a/packages/cloud_firestore_odm/example/lib/integration/named_query.g.dart +++ b/packages/cloud_firestore_odm/example/lib/integration/named_query.g.dart @@ -273,7 +273,11 @@ class _$ConflictDocumentReference _$ConflictFieldMap['number']!: numberFieldValue, }; - transaction.set(reference, json, options); + final castedReference = reference.withConverter>( + fromFirestore: (snapshot, options) => throw UnimplementedError(), + toFirestore: (value, options) => value, + ); + transaction.set(castedReference, json, options); } void batchSet( @@ -288,7 +292,11 @@ class _$ConflictDocumentReference _$ConflictFieldMap['number']!: numberFieldValue, }; - batch.set(reference, json, options); + final castedReference = reference.withConverter>( + fromFirestore: (snapshot, options) => throw UnimplementedError(), + toFirestore: (value, options) => value, + ); + batch.set(castedReference, json, options); } Future update({ @@ -830,25 +838,37 @@ class _$ConflictQuery extends QueryReference if (startAt != _sentinel) { queryCursor = queryCursor.copyWith( - startAt: [...queryCursor.startAt, startAt], + startAt: [ + ...queryCursor.startAt, + _$ConflictPerFieldToJson.number(startAt as num) + ], startAtDocumentSnapshot: null, ); } if (startAfter != _sentinel) { queryCursor = queryCursor.copyWith( - startAfter: [...queryCursor.startAfter, startAfter], + startAfter: [ + ...queryCursor.startAfter, + _$ConflictPerFieldToJson.number(startAfter as num) + ], startAfterDocumentSnapshot: null, ); } if (endAt != _sentinel) { queryCursor = queryCursor.copyWith( - endAt: [...queryCursor.endAt, endAt], + endAt: [ + ...queryCursor.endAt, + _$ConflictPerFieldToJson.number(endAt as num) + ], endAtDocumentSnapshot: null, ); } if (endBefore != _sentinel) { queryCursor = queryCursor.copyWith( - endBefore: [...queryCursor.endBefore, endBefore], + endBefore: [ + ...queryCursor.endBefore, + _$ConflictPerFieldToJson.number(endBefore as num) + ], endBeforeDocumentSnapshot: null, ); } diff --git a/packages/cloud_firestore_odm/example/lib/integration/query.g.dart b/packages/cloud_firestore_odm/example/lib/integration/query.g.dart index be83670..df80fe6 100644 --- a/packages/cloud_firestore_odm/example/lib/integration/query.g.dart +++ b/packages/cloud_firestore_odm/example/lib/integration/query.g.dart @@ -260,7 +260,11 @@ class _$DurationQueryDocumentReference extends FirestoreDocumentReference< _$DurationQueryFieldMap['duration']!: durationFieldValue, }; - transaction.set(reference, json, options); + final castedReference = reference.withConverter>( + fromFirestore: (snapshot, options) => throw UnimplementedError(), + toFirestore: (value, options) => value, + ); + transaction.set(castedReference, json, options); } void batchSet( @@ -275,7 +279,11 @@ class _$DurationQueryDocumentReference extends FirestoreDocumentReference< _$DurationQueryFieldMap['duration']!: durationFieldValue, }; - batch.set(reference, json, options); + final castedReference = reference.withConverter>( + fromFirestore: (snapshot, options) => throw UnimplementedError(), + toFirestore: (value, options) => value, + ); + batch.set(castedReference, json, options); } Future update({ @@ -823,25 +831,37 @@ class _$DurationQueryQuery if (startAt != _sentinel) { queryCursor = queryCursor.copyWith( - startAt: [...queryCursor.startAt, startAt], + startAt: [ + ...queryCursor.startAt, + _$DurationQueryPerFieldToJson.duration(startAt as Duration) + ], startAtDocumentSnapshot: null, ); } if (startAfter != _sentinel) { queryCursor = queryCursor.copyWith( - startAfter: [...queryCursor.startAfter, startAfter], + startAfter: [ + ...queryCursor.startAfter, + _$DurationQueryPerFieldToJson.duration(startAfter as Duration) + ], startAfterDocumentSnapshot: null, ); } if (endAt != _sentinel) { queryCursor = queryCursor.copyWith( - endAt: [...queryCursor.endAt, endAt], + endAt: [ + ...queryCursor.endAt, + _$DurationQueryPerFieldToJson.duration(endAt as Duration) + ], endAtDocumentSnapshot: null, ); } if (endBefore != _sentinel) { queryCursor = queryCursor.copyWith( - endBefore: [...queryCursor.endBefore, endBefore], + endBefore: [ + ...queryCursor.endBefore, + _$DurationQueryPerFieldToJson.duration(endBefore as Duration) + ], endBeforeDocumentSnapshot: null, ); } @@ -1190,7 +1210,11 @@ class _$DateTimeQueryDocumentReference extends FirestoreDocumentReference< _$DateTimeQueryFieldMap['time']!: timeFieldValue, }; - transaction.set(reference, json, options); + final castedReference = reference.withConverter>( + fromFirestore: (snapshot, options) => throw UnimplementedError(), + toFirestore: (value, options) => value, + ); + transaction.set(castedReference, json, options); } void batchSet( @@ -1205,7 +1229,11 @@ class _$DateTimeQueryDocumentReference extends FirestoreDocumentReference< _$DateTimeQueryFieldMap['time']!: timeFieldValue, }; - batch.set(reference, json, options); + final castedReference = reference.withConverter>( + fromFirestore: (snapshot, options) => throw UnimplementedError(), + toFirestore: (value, options) => value, + ); + batch.set(castedReference, json, options); } Future update({ @@ -1753,25 +1781,37 @@ class _$DateTimeQueryQuery if (startAt != _sentinel) { queryCursor = queryCursor.copyWith( - startAt: [...queryCursor.startAt, startAt], + startAt: [ + ...queryCursor.startAt, + _$DateTimeQueryPerFieldToJson.time(startAt as DateTime) + ], startAtDocumentSnapshot: null, ); } if (startAfter != _sentinel) { queryCursor = queryCursor.copyWith( - startAfter: [...queryCursor.startAfter, startAfter], + startAfter: [ + ...queryCursor.startAfter, + _$DateTimeQueryPerFieldToJson.time(startAfter as DateTime) + ], startAfterDocumentSnapshot: null, ); } if (endAt != _sentinel) { queryCursor = queryCursor.copyWith( - endAt: [...queryCursor.endAt, endAt], + endAt: [ + ...queryCursor.endAt, + _$DateTimeQueryPerFieldToJson.time(endAt as DateTime) + ], endAtDocumentSnapshot: null, ); } if (endBefore != _sentinel) { queryCursor = queryCursor.copyWith( - endBefore: [...queryCursor.endBefore, endBefore], + endBefore: [ + ...queryCursor.endBefore, + _$DateTimeQueryPerFieldToJson.time(endBefore as DateTime) + ], endBeforeDocumentSnapshot: null, ); } @@ -2122,7 +2162,11 @@ class _$TimestampQueryDocumentReference extends FirestoreDocumentReference< _$TimestampQueryFieldMap['time']!: timeFieldValue, }; - transaction.set(reference, json, options); + final castedReference = reference.withConverter>( + fromFirestore: (snapshot, options) => throw UnimplementedError(), + toFirestore: (value, options) => value, + ); + transaction.set(castedReference, json, options); } void batchSet( @@ -2137,7 +2181,11 @@ class _$TimestampQueryDocumentReference extends FirestoreDocumentReference< _$TimestampQueryFieldMap['time']!: timeFieldValue, }; - batch.set(reference, json, options); + final castedReference = reference.withConverter>( + fromFirestore: (snapshot, options) => throw UnimplementedError(), + toFirestore: (value, options) => value, + ); + batch.set(castedReference, json, options); } Future update({ @@ -2685,25 +2733,37 @@ class _$TimestampQueryQuery if (startAt != _sentinel) { queryCursor = queryCursor.copyWith( - startAt: [...queryCursor.startAt, startAt], + startAt: [ + ...queryCursor.startAt, + _$TimestampQueryPerFieldToJson.time(startAt as Timestamp) + ], startAtDocumentSnapshot: null, ); } if (startAfter != _sentinel) { queryCursor = queryCursor.copyWith( - startAfter: [...queryCursor.startAfter, startAfter], + startAfter: [ + ...queryCursor.startAfter, + _$TimestampQueryPerFieldToJson.time(startAfter as Timestamp) + ], startAfterDocumentSnapshot: null, ); } if (endAt != _sentinel) { queryCursor = queryCursor.copyWith( - endAt: [...queryCursor.endAt, endAt], + endAt: [ + ...queryCursor.endAt, + _$TimestampQueryPerFieldToJson.time(endAt as Timestamp) + ], endAtDocumentSnapshot: null, ); } if (endBefore != _sentinel) { queryCursor = queryCursor.copyWith( - endBefore: [...queryCursor.endBefore, endBefore], + endBefore: [ + ...queryCursor.endBefore, + _$TimestampQueryPerFieldToJson.time(endBefore as Timestamp) + ], endBeforeDocumentSnapshot: null, ); } @@ -3055,7 +3115,11 @@ class _$GeoPointQueryDocumentReference extends FirestoreDocumentReference< _$GeoPointQueryFieldMap['point']!: pointFieldValue, }; - transaction.set(reference, json, options); + final castedReference = reference.withConverter>( + fromFirestore: (snapshot, options) => throw UnimplementedError(), + toFirestore: (value, options) => value, + ); + transaction.set(castedReference, json, options); } void batchSet( @@ -3070,7 +3134,11 @@ class _$GeoPointQueryDocumentReference extends FirestoreDocumentReference< _$GeoPointQueryFieldMap['point']!: pointFieldValue, }; - batch.set(reference, json, options); + final castedReference = reference.withConverter>( + fromFirestore: (snapshot, options) => throw UnimplementedError(), + toFirestore: (value, options) => value, + ); + batch.set(castedReference, json, options); } Future update({ @@ -3618,25 +3686,37 @@ class _$GeoPointQueryQuery if (startAt != _sentinel) { queryCursor = queryCursor.copyWith( - startAt: [...queryCursor.startAt, startAt], + startAt: [ + ...queryCursor.startAt, + _$GeoPointQueryPerFieldToJson.point(startAt as GeoPoint) + ], startAtDocumentSnapshot: null, ); } if (startAfter != _sentinel) { queryCursor = queryCursor.copyWith( - startAfter: [...queryCursor.startAfter, startAfter], + startAfter: [ + ...queryCursor.startAfter, + _$GeoPointQueryPerFieldToJson.point(startAfter as GeoPoint) + ], startAfterDocumentSnapshot: null, ); } if (endAt != _sentinel) { queryCursor = queryCursor.copyWith( - endAt: [...queryCursor.endAt, endAt], + endAt: [ + ...queryCursor.endAt, + _$GeoPointQueryPerFieldToJson.point(endAt as GeoPoint) + ], endAtDocumentSnapshot: null, ); } if (endBefore != _sentinel) { queryCursor = queryCursor.copyWith( - endBefore: [...queryCursor.endBefore, endBefore], + endBefore: [ + ...queryCursor.endBefore, + _$GeoPointQueryPerFieldToJson.point(endBefore as GeoPoint) + ], endBeforeDocumentSnapshot: null, ); } @@ -3995,7 +4075,11 @@ class _$DocumentReferenceQueryDocumentReference _$DocumentReferenceQueryFieldMap['ref']!: refFieldValue, }; - transaction.set(reference, json, options); + final castedReference = reference.withConverter>( + fromFirestore: (snapshot, options) => throw UnimplementedError(), + toFirestore: (value, options) => value, + ); + transaction.set(castedReference, json, options); } void batchSet( @@ -4010,7 +4094,11 @@ class _$DocumentReferenceQueryDocumentReference _$DocumentReferenceQueryFieldMap['ref']!: refFieldValue, }; - batch.set(reference, json, options); + final castedReference = reference.withConverter>( + fromFirestore: (snapshot, options) => throw UnimplementedError(), + toFirestore: (value, options) => value, + ); + batch.set(castedReference, json, options); } Future update({ @@ -4570,25 +4658,41 @@ class _$DocumentReferenceQueryQuery extends QueryReference< if (startAt != _sentinel) { queryCursor = queryCursor.copyWith( - startAt: [...queryCursor.startAt, startAt], + startAt: [ + ...queryCursor.startAt, + _$DocumentReferenceQueryPerFieldToJson + .ref(startAt as DocumentReference>) + ], startAtDocumentSnapshot: null, ); } if (startAfter != _sentinel) { queryCursor = queryCursor.copyWith( - startAfter: [...queryCursor.startAfter, startAfter], + startAfter: [ + ...queryCursor.startAfter, + _$DocumentReferenceQueryPerFieldToJson + .ref(startAfter as DocumentReference>) + ], startAfterDocumentSnapshot: null, ); } if (endAt != _sentinel) { queryCursor = queryCursor.copyWith( - endAt: [...queryCursor.endAt, endAt], + endAt: [ + ...queryCursor.endAt, + _$DocumentReferenceQueryPerFieldToJson + .ref(endAt as DocumentReference>) + ], endAtDocumentSnapshot: null, ); } if (endBefore != _sentinel) { queryCursor = queryCursor.copyWith( - endBefore: [...queryCursor.endBefore, endBefore], + endBefore: [ + ...queryCursor.endBefore, + _$DocumentReferenceQueryPerFieldToJson + .ref(endBefore as DocumentReference>) + ], endBeforeDocumentSnapshot: null, ); } diff --git a/packages/cloud_firestore_odm/example/lib/movie.g.dart b/packages/cloud_firestore_odm/example/lib/movie.g.dart index f12e30a..17aee54 100644 --- a/packages/cloud_firestore_odm/example/lib/movie.g.dart +++ b/packages/cloud_firestore_odm/example/lib/movie.g.dart @@ -323,7 +323,7 @@ class _$MovieDocumentReference final castedReference = reference.withConverter>( fromFirestore: (snapshot, options) => throw UnimplementedError(), - toFirestore: (value, options) => value, + toFirestore: (value, options) => value..remove('id'), ); return castedReference.set(json, options); } @@ -355,7 +355,11 @@ class _$MovieDocumentReference if (tagsFieldValue != null) _$MovieFieldMap['tags']!: tagsFieldValue, }; - transaction.set(reference, json, options); + final castedReference = reference.withConverter>( + fromFirestore: (snapshot, options) => throw UnimplementedError(), + toFirestore: (value, options) => value..remove('id'), + ); + transaction.set(castedReference, json, options); } void batchSet( @@ -385,7 +389,11 @@ class _$MovieDocumentReference if (tagsFieldValue != null) _$MovieFieldMap['tags']!: tagsFieldValue, }; - batch.set(reference, json, options); + final castedReference = reference.withConverter>( + fromFirestore: (snapshot, options) => throw UnimplementedError(), + toFirestore: (value, options) => value..remove('id'), + ); + batch.set(castedReference, json, options); } Future update({ @@ -1612,25 +1620,37 @@ class _$MovieQuery extends QueryReference if (startAt != _sentinel) { queryCursor = queryCursor.copyWith( - startAt: [...queryCursor.startAt, startAt], + startAt: [ + ...queryCursor.startAt, + _$MoviePerFieldToJson.poster(startAt as String) + ], startAtDocumentSnapshot: null, ); } if (startAfter != _sentinel) { queryCursor = queryCursor.copyWith( - startAfter: [...queryCursor.startAfter, startAfter], + startAfter: [ + ...queryCursor.startAfter, + _$MoviePerFieldToJson.poster(startAfter as String) + ], startAfterDocumentSnapshot: null, ); } if (endAt != _sentinel) { queryCursor = queryCursor.copyWith( - endAt: [...queryCursor.endAt, endAt], + endAt: [ + ...queryCursor.endAt, + _$MoviePerFieldToJson.poster(endAt as String) + ], endAtDocumentSnapshot: null, ); } if (endBefore != _sentinel) { queryCursor = queryCursor.copyWith( - endBefore: [...queryCursor.endBefore, endBefore], + endBefore: [ + ...queryCursor.endBefore, + _$MoviePerFieldToJson.poster(endBefore as String) + ], endBeforeDocumentSnapshot: null, ); } @@ -1685,25 +1705,37 @@ class _$MovieQuery extends QueryReference if (startAt != _sentinel) { queryCursor = queryCursor.copyWith( - startAt: [...queryCursor.startAt, startAt], + startAt: [ + ...queryCursor.startAt, + _$MoviePerFieldToJson.likes(startAt as int) + ], startAtDocumentSnapshot: null, ); } if (startAfter != _sentinel) { queryCursor = queryCursor.copyWith( - startAfter: [...queryCursor.startAfter, startAfter], + startAfter: [ + ...queryCursor.startAfter, + _$MoviePerFieldToJson.likes(startAfter as int) + ], startAfterDocumentSnapshot: null, ); } if (endAt != _sentinel) { queryCursor = queryCursor.copyWith( - endAt: [...queryCursor.endAt, endAt], + endAt: [ + ...queryCursor.endAt, + _$MoviePerFieldToJson.likes(endAt as int) + ], endAtDocumentSnapshot: null, ); } if (endBefore != _sentinel) { queryCursor = queryCursor.copyWith( - endBefore: [...queryCursor.endBefore, endBefore], + endBefore: [ + ...queryCursor.endBefore, + _$MoviePerFieldToJson.likes(endBefore as int) + ], endBeforeDocumentSnapshot: null, ); } @@ -1758,25 +1790,37 @@ class _$MovieQuery extends QueryReference if (startAt != _sentinel) { queryCursor = queryCursor.copyWith( - startAt: [...queryCursor.startAt, startAt], + startAt: [ + ...queryCursor.startAt, + _$MoviePerFieldToJson.title(startAt as String) + ], startAtDocumentSnapshot: null, ); } if (startAfter != _sentinel) { queryCursor = queryCursor.copyWith( - startAfter: [...queryCursor.startAfter, startAfter], + startAfter: [ + ...queryCursor.startAfter, + _$MoviePerFieldToJson.title(startAfter as String) + ], startAfterDocumentSnapshot: null, ); } if (endAt != _sentinel) { queryCursor = queryCursor.copyWith( - endAt: [...queryCursor.endAt, endAt], + endAt: [ + ...queryCursor.endAt, + _$MoviePerFieldToJson.title(endAt as String) + ], endAtDocumentSnapshot: null, ); } if (endBefore != _sentinel) { queryCursor = queryCursor.copyWith( - endBefore: [...queryCursor.endBefore, endBefore], + endBefore: [ + ...queryCursor.endBefore, + _$MoviePerFieldToJson.title(endBefore as String) + ], endBeforeDocumentSnapshot: null, ); } @@ -1831,25 +1875,34 @@ class _$MovieQuery extends QueryReference if (startAt != _sentinel) { queryCursor = queryCursor.copyWith( - startAt: [...queryCursor.startAt, startAt], + startAt: [ + ...queryCursor.startAt, + _$MoviePerFieldToJson.year(startAt as int) + ], startAtDocumentSnapshot: null, ); } if (startAfter != _sentinel) { queryCursor = queryCursor.copyWith( - startAfter: [...queryCursor.startAfter, startAfter], + startAfter: [ + ...queryCursor.startAfter, + _$MoviePerFieldToJson.year(startAfter as int) + ], startAfterDocumentSnapshot: null, ); } if (endAt != _sentinel) { queryCursor = queryCursor.copyWith( - endAt: [...queryCursor.endAt, endAt], + endAt: [...queryCursor.endAt, _$MoviePerFieldToJson.year(endAt as int)], endAtDocumentSnapshot: null, ); } if (endBefore != _sentinel) { queryCursor = queryCursor.copyWith( - endBefore: [...queryCursor.endBefore, endBefore], + endBefore: [ + ...queryCursor.endBefore, + _$MoviePerFieldToJson.year(endBefore as int) + ], endBeforeDocumentSnapshot: null, ); } @@ -1904,25 +1957,37 @@ class _$MovieQuery extends QueryReference if (startAt != _sentinel) { queryCursor = queryCursor.copyWith( - startAt: [...queryCursor.startAt, startAt], + startAt: [ + ...queryCursor.startAt, + _$MoviePerFieldToJson.runtime(startAt as String) + ], startAtDocumentSnapshot: null, ); } if (startAfter != _sentinel) { queryCursor = queryCursor.copyWith( - startAfter: [...queryCursor.startAfter, startAfter], + startAfter: [ + ...queryCursor.startAfter, + _$MoviePerFieldToJson.runtime(startAfter as String) + ], startAfterDocumentSnapshot: null, ); } if (endAt != _sentinel) { queryCursor = queryCursor.copyWith( - endAt: [...queryCursor.endAt, endAt], + endAt: [ + ...queryCursor.endAt, + _$MoviePerFieldToJson.runtime(endAt as String) + ], endAtDocumentSnapshot: null, ); } if (endBefore != _sentinel) { queryCursor = queryCursor.copyWith( - endBefore: [...queryCursor.endBefore, endBefore], + endBefore: [ + ...queryCursor.endBefore, + _$MoviePerFieldToJson.runtime(endBefore as String) + ], endBeforeDocumentSnapshot: null, ); } @@ -1977,25 +2042,37 @@ class _$MovieQuery extends QueryReference if (startAt != _sentinel) { queryCursor = queryCursor.copyWith( - startAt: [...queryCursor.startAt, startAt], + startAt: [ + ...queryCursor.startAt, + _$MoviePerFieldToJson.rated(startAt as String) + ], startAtDocumentSnapshot: null, ); } if (startAfter != _sentinel) { queryCursor = queryCursor.copyWith( - startAfter: [...queryCursor.startAfter, startAfter], + startAfter: [ + ...queryCursor.startAfter, + _$MoviePerFieldToJson.rated(startAfter as String) + ], startAfterDocumentSnapshot: null, ); } if (endAt != _sentinel) { queryCursor = queryCursor.copyWith( - endAt: [...queryCursor.endAt, endAt], + endAt: [ + ...queryCursor.endAt, + _$MoviePerFieldToJson.rated(endAt as String) + ], endAtDocumentSnapshot: null, ); } if (endBefore != _sentinel) { queryCursor = queryCursor.copyWith( - endBefore: [...queryCursor.endBefore, endBefore], + endBefore: [ + ...queryCursor.endBefore, + _$MoviePerFieldToJson.rated(endBefore as String) + ], endBeforeDocumentSnapshot: null, ); } @@ -2050,25 +2127,37 @@ class _$MovieQuery extends QueryReference if (startAt != _sentinel) { queryCursor = queryCursor.copyWith( - startAt: [...queryCursor.startAt, startAt], + startAt: [ + ...queryCursor.startAt, + _$MoviePerFieldToJson.genre(startAt as List?) + ], startAtDocumentSnapshot: null, ); } if (startAfter != _sentinel) { queryCursor = queryCursor.copyWith( - startAfter: [...queryCursor.startAfter, startAfter], + startAfter: [ + ...queryCursor.startAfter, + _$MoviePerFieldToJson.genre(startAfter as List?) + ], startAfterDocumentSnapshot: null, ); } if (endAt != _sentinel) { queryCursor = queryCursor.copyWith( - endAt: [...queryCursor.endAt, endAt], + endAt: [ + ...queryCursor.endAt, + _$MoviePerFieldToJson.genre(endAt as List?) + ], endAtDocumentSnapshot: null, ); } if (endBefore != _sentinel) { queryCursor = queryCursor.copyWith( - endBefore: [...queryCursor.endBefore, endBefore], + endBefore: [ + ...queryCursor.endBefore, + _$MoviePerFieldToJson.genre(endBefore as List?) + ], endBeforeDocumentSnapshot: null, ); } @@ -2123,25 +2212,37 @@ class _$MovieQuery extends QueryReference if (startAt != _sentinel) { queryCursor = queryCursor.copyWith( - startAt: [...queryCursor.startAt, startAt], + startAt: [ + ...queryCursor.startAt, + _$MoviePerFieldToJson.tags(startAt as Set?) + ], startAtDocumentSnapshot: null, ); } if (startAfter != _sentinel) { queryCursor = queryCursor.copyWith( - startAfter: [...queryCursor.startAfter, startAfter], + startAfter: [ + ...queryCursor.startAfter, + _$MoviePerFieldToJson.tags(startAfter as Set?) + ], startAfterDocumentSnapshot: null, ); } if (endAt != _sentinel) { queryCursor = queryCursor.copyWith( - endAt: [...queryCursor.endAt, endAt], + endAt: [ + ...queryCursor.endAt, + _$MoviePerFieldToJson.tags(endAt as Set?) + ], endAtDocumentSnapshot: null, ); } if (endBefore != _sentinel) { queryCursor = queryCursor.copyWith( - endBefore: [...queryCursor.endBefore, endBefore], + endBefore: [ + ...queryCursor.endBefore, + _$MoviePerFieldToJson.tags(endBefore as Set?) + ], endBeforeDocumentSnapshot: null, ); } @@ -2514,7 +2615,11 @@ class _$CommentDocumentReference _$CommentFieldMap['message']!: messageFieldValue, }; - transaction.set(reference, json, options); + final castedReference = reference.withConverter>( + fromFirestore: (snapshot, options) => throw UnimplementedError(), + toFirestore: (value, options) => value, + ); + transaction.set(castedReference, json, options); } void batchSet( @@ -2532,7 +2637,11 @@ class _$CommentDocumentReference _$CommentFieldMap['message']!: messageFieldValue, }; - batch.set(reference, json, options); + final castedReference = reference.withConverter>( + fromFirestore: (snapshot, options) => throw UnimplementedError(), + toFirestore: (value, options) => value, + ); + batch.set(castedReference, json, options); } Future update({ @@ -3175,25 +3284,37 @@ class _$CommentQuery extends QueryReference if (startAt != _sentinel) { queryCursor = queryCursor.copyWith( - startAt: [...queryCursor.startAt, startAt], + startAt: [ + ...queryCursor.startAt, + _$CommentPerFieldToJson.authorName(startAt as String) + ], startAtDocumentSnapshot: null, ); } if (startAfter != _sentinel) { queryCursor = queryCursor.copyWith( - startAfter: [...queryCursor.startAfter, startAfter], + startAfter: [ + ...queryCursor.startAfter, + _$CommentPerFieldToJson.authorName(startAfter as String) + ], startAfterDocumentSnapshot: null, ); } if (endAt != _sentinel) { queryCursor = queryCursor.copyWith( - endAt: [...queryCursor.endAt, endAt], + endAt: [ + ...queryCursor.endAt, + _$CommentPerFieldToJson.authorName(endAt as String) + ], endAtDocumentSnapshot: null, ); } if (endBefore != _sentinel) { queryCursor = queryCursor.copyWith( - endBefore: [...queryCursor.endBefore, endBefore], + endBefore: [ + ...queryCursor.endBefore, + _$CommentPerFieldToJson.authorName(endBefore as String) + ], endBeforeDocumentSnapshot: null, ); } @@ -3248,25 +3369,37 @@ class _$CommentQuery extends QueryReference if (startAt != _sentinel) { queryCursor = queryCursor.copyWith( - startAt: [...queryCursor.startAt, startAt], + startAt: [ + ...queryCursor.startAt, + _$CommentPerFieldToJson.message(startAt as String) + ], startAtDocumentSnapshot: null, ); } if (startAfter != _sentinel) { queryCursor = queryCursor.copyWith( - startAfter: [...queryCursor.startAfter, startAfter], + startAfter: [ + ...queryCursor.startAfter, + _$CommentPerFieldToJson.message(startAfter as String) + ], startAfterDocumentSnapshot: null, ); } if (endAt != _sentinel) { queryCursor = queryCursor.copyWith( - endAt: [...queryCursor.endAt, endAt], + endAt: [ + ...queryCursor.endAt, + _$CommentPerFieldToJson.message(endAt as String) + ], endAtDocumentSnapshot: null, ); } if (endBefore != _sentinel) { queryCursor = queryCursor.copyWith( - endBefore: [...queryCursor.endBefore, endBefore], + endBefore: [ + ...queryCursor.endBefore, + _$CommentPerFieldToJson.message(endBefore as String) + ], endBeforeDocumentSnapshot: null, ); } diff --git a/packages/cloud_firestore_odm/example/pubspec.yaml b/packages/cloud_firestore_odm/example/pubspec.yaml index a6e669f..d24240e 100644 --- a/packages/cloud_firestore_odm/example/pubspec.yaml +++ b/packages/cloud_firestore_odm/example/pubspec.yaml @@ -5,9 +5,9 @@ environment: sdk: ">=3.0.0 <4.0.0" dependencies: - cloud_firestore: ^5.6.5 - cloud_firestore_odm: ^1.1.0 - firebase_core: ^3.0.0 + cloud_firestore: ^6.0.0 + cloud_firestore_odm: ^1.2.0 + firebase_core: ^4.0.0 flutter: sdk: flutter freezed_annotation: ^3.0.0 diff --git a/packages/cloud_firestore_odm/example/web/index.html b/packages/cloud_firestore_odm/example/web/index.html index ab4fd86..86c769e 100644 --- a/packages/cloud_firestore_odm/example/web/index.html +++ b/packages/cloud_firestore_odm/example/web/index.html @@ -30,72 +30,6 @@ - - + diff --git a/packages/cloud_firestore_odm/pubspec.yaml b/packages/cloud_firestore_odm/pubspec.yaml index 84a2941..ad66088 100644 --- a/packages/cloud_firestore_odm/pubspec.yaml +++ b/packages/cloud_firestore_odm/pubspec.yaml @@ -2,7 +2,7 @@ name: cloud_firestore_odm description: An ODM for Firebase Cloud Firestore (cloud_firestore). homepage: https://github.com/firebaseextended/firestoreodm-flutter repository: https://github.com/firebaseextended/firestoreodm-flutter -version: 1.1.0 +version: 1.2.0 false_secrets: - example/** @@ -11,7 +11,7 @@ environment: sdk: ">=3.0.0 <4.0.0" dependencies: - cloud_firestore: ^5.0.2 + cloud_firestore: ^6.0.0 flutter: sdk: flutter json_annotation: ^4.9.0 @@ -20,4 +20,4 @@ dependencies: dev_dependencies: flutter_test: sdk: flutter - test: ^1.25.1 + test: ^1.25.15 diff --git a/packages/cloud_firestore_odm_generator/CHANGELOG.md b/packages/cloud_firestore_odm_generator/CHANGELOG.md index 34cd24c..ae0f17d 100644 --- a/packages/cloud_firestore_odm_generator/CHANGELOG.md +++ b/packages/cloud_firestore_odm_generator/CHANGELOG.md @@ -1,3 +1,7 @@ +## 1.2.0 +- **FIX**: `set`, `batchSet` and `transacrtionSet` methods would keep the `@ID() id` in the object in DB. +- **CHORE**: Update cloud_firestore to ^6.0.0 + ## 1.1.0 - **FIX**: Resolve compatibility issues with Freezed 3.0.0 and above diff --git a/packages/cloud_firestore_odm_generator/cloud_firestore_odm_generator_integration_test/lib/freezed.freezed.dart b/packages/cloud_firestore_odm_generator/cloud_firestore_odm_generator_integration_test/lib/freezed.freezed.dart index 661f349..d7f233b 100644 --- a/packages/cloud_firestore_odm_generator/cloud_firestore_odm_generator_integration_test/lib/freezed.freezed.dart +++ b/packages/cloud_firestore_odm_generator/cloud_firestore_odm_generator_integration_test/lib/freezed.freezed.dart @@ -1,6 +1,5 @@ -// dart format width=80 -// coverage:ignore-file // GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file // ignore_for_file: type=lint // ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark @@ -97,6 +96,177 @@ class _$PersonCopyWithImpl<$Res> implements $PersonCopyWith<$Res> { } } +/// Adds pattern-matching-related methods to [Person]. +extension PersonPatterns on Person { + /// A variant of `map` that fallback to returning `orElse`. + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case final Subclass value: + /// return ...; + /// case _: + /// return orElse(); + /// } + /// ``` + + @optionalTypeArgs + TResult maybeMap( + TResult Function(_Person value)? $default, { + required TResult orElse(), + }) { + final _that = this; + switch (_that) { + case _Person() when $default != null: + return $default(_that); + case _: + return orElse(); + } + } + + /// A `switch`-like method, using callbacks. + /// + /// Callbacks receives the raw object, upcasted. + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case final Subclass value: + /// return ...; + /// case final Subclass2 value: + /// return ...; + /// } + /// ``` + + @optionalTypeArgs + TResult map( + TResult Function(_Person value) $default, + ) { + final _that = this; + switch (_that) { + case _Person(): + return $default(_that); + case _: + throw StateError('Unexpected subclass'); + } + } + + /// A variant of `map` that fallback to returning `null`. + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case final Subclass value: + /// return ...; + /// case _: + /// return null; + /// } + /// ``` + + @optionalTypeArgs + TResult? mapOrNull( + TResult? Function(_Person value)? $default, + ) { + final _that = this; + switch (_that) { + case _Person() when $default != null: + return $default(_that); + case _: + return null; + } + } + + /// A variant of `when` that fallback to an `orElse` callback. + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case Subclass(:final field): + /// return ...; + /// case _: + /// return orElse(); + /// } + /// ``` + + @optionalTypeArgs + TResult maybeWhen( + TResult Function( + String firstName, + @JsonKey(name: 'LAST_NAME') String lastName, + @JsonKey(includeFromJson: false, includeToJson: false) + int? ignored)? + $default, { + required TResult orElse(), + }) { + final _that = this; + switch (_that) { + case _Person() when $default != null: + return $default(_that.firstName, _that.lastName, _that.ignored); + case _: + return orElse(); + } + } + + /// A `switch`-like method, using callbacks. + /// + /// As opposed to `map`, this offers destructuring. + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case Subclass(:final field): + /// return ...; + /// case Subclass2(:final field2): + /// return ...; + /// } + /// ``` + + @optionalTypeArgs + TResult when( + TResult Function( + String firstName, + @JsonKey(name: 'LAST_NAME') String lastName, + @JsonKey(includeFromJson: false, includeToJson: false) int? ignored) + $default, + ) { + final _that = this; + switch (_that) { + case _Person(): + return $default(_that.firstName, _that.lastName, _that.ignored); + case _: + throw StateError('Unexpected subclass'); + } + } + + /// A variant of `when` that fallback to returning `null` + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case Subclass(:final field): + /// return ...; + /// case _: + /// return null; + /// } + /// ``` + + @optionalTypeArgs + TResult? whenOrNull( + TResult? Function( + String firstName, + @JsonKey(name: 'LAST_NAME') String lastName, + @JsonKey(includeFromJson: false, includeToJson: false) + int? ignored)? + $default, + ) { + final _that = this; + switch (_that) { + case _Person() when $default != null: + return $default(_that.firstName, _that.lastName, _that.ignored); + case _: + return null; + } + } +} + /// @nodoc @JsonSerializable(fieldRename: FieldRename.snake) @@ -268,6 +438,163 @@ class _$PublicRedirectedCopyWithImpl<$Res> } } +/// Adds pattern-matching-related methods to [PublicRedirected]. +extension PublicRedirectedPatterns on PublicRedirected { + /// A variant of `map` that fallback to returning `orElse`. + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case final Subclass value: + /// return ...; + /// case _: + /// return orElse(); + /// } + /// ``` + + @optionalTypeArgs + TResult maybeMap( + TResult Function(PublicRedirected2 value)? $default, { + required TResult orElse(), + }) { + final _that = this; + switch (_that) { + case PublicRedirected2() when $default != null: + return $default(_that); + case _: + return orElse(); + } + } + + /// A `switch`-like method, using callbacks. + /// + /// Callbacks receives the raw object, upcasted. + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case final Subclass value: + /// return ...; + /// case final Subclass2 value: + /// return ...; + /// } + /// ``` + + @optionalTypeArgs + TResult map( + TResult Function(PublicRedirected2 value) $default, + ) { + final _that = this; + switch (_that) { + case PublicRedirected2(): + return $default(_that); + case _: + throw StateError('Unexpected subclass'); + } + } + + /// A variant of `map` that fallback to returning `null`. + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case final Subclass value: + /// return ...; + /// case _: + /// return null; + /// } + /// ``` + + @optionalTypeArgs + TResult? mapOrNull( + TResult? Function(PublicRedirected2 value)? $default, + ) { + final _that = this; + switch (_that) { + case PublicRedirected2() when $default != null: + return $default(_that); + case _: + return null; + } + } + + /// A variant of `when` that fallback to an `orElse` callback. + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case Subclass(:final field): + /// return ...; + /// case _: + /// return orElse(); + /// } + /// ``` + + @optionalTypeArgs + TResult maybeWhen( + TResult Function(String value)? $default, { + required TResult orElse(), + }) { + final _that = this; + switch (_that) { + case PublicRedirected2() when $default != null: + return $default(_that.value); + case _: + return orElse(); + } + } + + /// A `switch`-like method, using callbacks. + /// + /// As opposed to `map`, this offers destructuring. + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case Subclass(:final field): + /// return ...; + /// case Subclass2(:final field2): + /// return ...; + /// } + /// ``` + + @optionalTypeArgs + TResult when( + TResult Function(String value) $default, + ) { + final _that = this; + switch (_that) { + case PublicRedirected2(): + return $default(_that.value); + case _: + throw StateError('Unexpected subclass'); + } + } + + /// A variant of `when` that fallback to returning `null` + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case Subclass(:final field): + /// return ...; + /// case _: + /// return null; + /// } + /// ``` + + @optionalTypeArgs + TResult? whenOrNull( + TResult? Function(String value)? $default, + ) { + final _that = this; + switch (_that) { + case PublicRedirected2() when $default != null: + return $default(_that.value); + case _: + return null; + } + } +} + /// @nodoc @JsonSerializable() class PublicRedirected2 implements PublicRedirected { @@ -409,4 +736,139 @@ class _$SimpleFreezedCopyWithImpl<$Res> } } +/// Adds pattern-matching-related methods to [SimpleFreezed]. +extension SimpleFreezedPatterns on SimpleFreezed { + /// A variant of `map` that fallback to returning `orElse`. + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case final Subclass value: + /// return ...; + /// case _: + /// return orElse(); + /// } + /// ``` + + @optionalTypeArgs + TResult maybeMap({ + required TResult orElse(), + }) { + final _that = this; + switch (_that) { + case _: + return orElse(); + } + } + + /// A `switch`-like method, using callbacks. + /// + /// Callbacks receives the raw object, upcasted. + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case final Subclass value: + /// return ...; + /// case final Subclass2 value: + /// return ...; + /// } + /// ``` + + @optionalTypeArgs + TResult map() { + final _that = this; + switch (_that) { + case _: + throw StateError('Unexpected subclass'); + } + } + + /// A variant of `map` that fallback to returning `null`. + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case final Subclass value: + /// return ...; + /// case _: + /// return null; + /// } + /// ``` + + @optionalTypeArgs + TResult? mapOrNull() { + final _that = this; + switch (_that) { + case _: + return null; + } + } + + /// A variant of `when` that fallback to an `orElse` callback. + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case Subclass(:final field): + /// return ...; + /// case _: + /// return orElse(); + /// } + /// ``` + + @optionalTypeArgs + TResult maybeWhen({ + required TResult orElse(), + }) { + final _that = this; + switch (_that) { + case _: + return orElse(); + } + } + + /// A `switch`-like method, using callbacks. + /// + /// As opposed to `map`, this offers destructuring. + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case Subclass(:final field): + /// return ...; + /// case Subclass2(:final field2): + /// return ...; + /// } + /// ``` + + @optionalTypeArgs + TResult when() { + final _that = this; + switch (_that) { + case _: + throw StateError('Unexpected subclass'); + } + } + + /// A variant of `when` that fallback to returning `null` + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case Subclass(:final field): + /// return ...; + /// case _: + /// return null; + /// } + /// ``` + + @optionalTypeArgs + TResult? whenOrNull() { + final _that = this; + switch (_that) { + case _: + return null; + } + } +} + // dart format on diff --git a/packages/cloud_firestore_odm_generator/cloud_firestore_odm_generator_integration_test/lib/freezed.g.dart b/packages/cloud_firestore_odm_generator/cloud_firestore_odm_generator_integration_test/lib/freezed.g.dart index 206181b..85a3fa1 100644 --- a/packages/cloud_firestore_odm_generator/cloud_firestore_odm_generator_integration_test/lib/freezed.g.dart +++ b/packages/cloud_firestore_odm_generator/cloud_firestore_odm_generator_integration_test/lib/freezed.g.dart @@ -267,7 +267,11 @@ class _$PersonDocumentReference _$PersonFieldMap['lastName']!: lastNameFieldValue, }; - transaction.set(reference, json, options); + final castedReference = reference.withConverter>( + fromFirestore: (snapshot, options) => throw UnimplementedError(), + toFirestore: (value, options) => value, + ); + transaction.set(castedReference, json, options); } void batchSet( @@ -285,7 +289,11 @@ class _$PersonDocumentReference _$PersonFieldMap['lastName']!: lastNameFieldValue, }; - batch.set(reference, json, options); + final castedReference = reference.withConverter>( + fromFirestore: (snapshot, options) => throw UnimplementedError(), + toFirestore: (value, options) => value, + ); + batch.set(castedReference, json, options); } Future update({ @@ -926,25 +934,37 @@ class _$PersonQuery extends QueryReference if (startAt != _sentinel) { queryCursor = queryCursor.copyWith( - startAt: [...queryCursor.startAt, startAt], + startAt: [ + ...queryCursor.startAt, + _$PersonPerFieldToJson.firstName(startAt as String) + ], startAtDocumentSnapshot: null, ); } if (startAfter != _sentinel) { queryCursor = queryCursor.copyWith( - startAfter: [...queryCursor.startAfter, startAfter], + startAfter: [ + ...queryCursor.startAfter, + _$PersonPerFieldToJson.firstName(startAfter as String) + ], startAfterDocumentSnapshot: null, ); } if (endAt != _sentinel) { queryCursor = queryCursor.copyWith( - endAt: [...queryCursor.endAt, endAt], + endAt: [ + ...queryCursor.endAt, + _$PersonPerFieldToJson.firstName(endAt as String) + ], endAtDocumentSnapshot: null, ); } if (endBefore != _sentinel) { queryCursor = queryCursor.copyWith( - endBefore: [...queryCursor.endBefore, endBefore], + endBefore: [ + ...queryCursor.endBefore, + _$PersonPerFieldToJson.firstName(endBefore as String) + ], endBeforeDocumentSnapshot: null, ); } @@ -999,25 +1019,37 @@ class _$PersonQuery extends QueryReference if (startAt != _sentinel) { queryCursor = queryCursor.copyWith( - startAt: [...queryCursor.startAt, startAt], + startAt: [ + ...queryCursor.startAt, + _$PersonPerFieldToJson.lastName(startAt as String) + ], startAtDocumentSnapshot: null, ); } if (startAfter != _sentinel) { queryCursor = queryCursor.copyWith( - startAfter: [...queryCursor.startAfter, startAfter], + startAfter: [ + ...queryCursor.startAfter, + _$PersonPerFieldToJson.lastName(startAfter as String) + ], startAfterDocumentSnapshot: null, ); } if (endAt != _sentinel) { queryCursor = queryCursor.copyWith( - endAt: [...queryCursor.endAt, endAt], + endAt: [ + ...queryCursor.endAt, + _$PersonPerFieldToJson.lastName(endAt as String) + ], endAtDocumentSnapshot: null, ); } if (endBefore != _sentinel) { queryCursor = queryCursor.copyWith( - endBefore: [...queryCursor.endBefore, endBefore], + endBefore: [ + ...queryCursor.endBefore, + _$PersonPerFieldToJson.lastName(endBefore as String) + ], endBeforeDocumentSnapshot: null, ); } @@ -1364,7 +1396,11 @@ class _$PublicRedirectedDocumentReference extends FirestoreDocumentReference< _$PublicRedirected2FieldMap['value']!: valueFieldValue, }; - transaction.set(reference, json, options); + final castedReference = reference.withConverter>( + fromFirestore: (snapshot, options) => throw UnimplementedError(), + toFirestore: (value, options) => value, + ); + transaction.set(castedReference, json, options); } void batchSet( @@ -1379,7 +1415,11 @@ class _$PublicRedirectedDocumentReference extends FirestoreDocumentReference< _$PublicRedirected2FieldMap['value']!: valueFieldValue, }; - batch.set(reference, json, options); + final castedReference = reference.withConverter>( + fromFirestore: (snapshot, options) => throw UnimplementedError(), + toFirestore: (value, options) => value, + ); + batch.set(castedReference, json, options); } Future update({ @@ -1928,25 +1968,37 @@ class _$PublicRedirectedQuery if (startAt != _sentinel) { queryCursor = queryCursor.copyWith( - startAt: [...queryCursor.startAt, startAt], + startAt: [ + ...queryCursor.startAt, + _$PublicRedirected2PerFieldToJson.value(startAt as String) + ], startAtDocumentSnapshot: null, ); } if (startAfter != _sentinel) { queryCursor = queryCursor.copyWith( - startAfter: [...queryCursor.startAfter, startAfter], + startAfter: [ + ...queryCursor.startAfter, + _$PublicRedirected2PerFieldToJson.value(startAfter as String) + ], startAfterDocumentSnapshot: null, ); } if (endAt != _sentinel) { queryCursor = queryCursor.copyWith( - endAt: [...queryCursor.endAt, endAt], + endAt: [ + ...queryCursor.endAt, + _$PublicRedirected2PerFieldToJson.value(endAt as String) + ], endAtDocumentSnapshot: null, ); } if (endBefore != _sentinel) { queryCursor = queryCursor.copyWith( - endBefore: [...queryCursor.endBefore, endBefore], + endBefore: [ + ...queryCursor.endBefore, + _$PublicRedirected2PerFieldToJson.value(endBefore as String) + ], endBeforeDocumentSnapshot: null, ); } @@ -2080,7 +2132,7 @@ abstract class SimpleFreezedCollectionReference SimpleFreezed value, SetOptions? options, ) { - return _$SimpleFreezedToJson(value); + return value.toJson(); } @override @@ -2274,7 +2326,7 @@ class _$SimpleFreezedDocumentReference extends FirestoreDocumentReference< FieldValue? aFieldValue, }) async { final json = { - ..._$SimpleFreezedToJson(model), + ...model.toJson(), if (aFieldValue != null) _$SimpleFreezedFieldMap['a']!: aFieldValue, }; @@ -2292,11 +2344,15 @@ class _$SimpleFreezedDocumentReference extends FirestoreDocumentReference< FieldValue? aFieldValue, }) { final json = { - ..._$SimpleFreezedToJson(model), + ...model.toJson(), if (aFieldValue != null) _$SimpleFreezedFieldMap['a']!: aFieldValue, }; - transaction.set(reference, json, options); + final castedReference = reference.withConverter>( + fromFirestore: (snapshot, options) => throw UnimplementedError(), + toFirestore: (value, options) => value, + ); + transaction.set(castedReference, json, options); } void batchSet( @@ -2306,11 +2362,15 @@ class _$SimpleFreezedDocumentReference extends FirestoreDocumentReference< FieldValue? aFieldValue, }) { final json = { - ..._$SimpleFreezedToJson(model), + ...model.toJson(), if (aFieldValue != null) _$SimpleFreezedFieldMap['a']!: aFieldValue, }; - batch.set(reference, json, options); + final castedReference = reference.withConverter>( + fromFirestore: (snapshot, options) => throw UnimplementedError(), + toFirestore: (value, options) => value, + ); + batch.set(castedReference, json, options); } Future update({ @@ -2852,25 +2912,37 @@ class _$SimpleFreezedQuery if (startAt != _sentinel) { queryCursor = queryCursor.copyWith( - startAt: [...queryCursor.startAt, startAt], + startAt: [ + ...queryCursor.startAt, + _$SimpleFreezedPerFieldToJson.a(startAt as int) + ], startAtDocumentSnapshot: null, ); } if (startAfter != _sentinel) { queryCursor = queryCursor.copyWith( - startAfter: [...queryCursor.startAfter, startAfter], + startAfter: [ + ...queryCursor.startAfter, + _$SimpleFreezedPerFieldToJson.a(startAfter as int) + ], startAfterDocumentSnapshot: null, ); } if (endAt != _sentinel) { queryCursor = queryCursor.copyWith( - endAt: [...queryCursor.endAt, endAt], + endAt: [ + ...queryCursor.endAt, + _$SimpleFreezedPerFieldToJson.a(endAt as int) + ], endAtDocumentSnapshot: null, ); } if (endBefore != _sentinel) { queryCursor = queryCursor.copyWith( - endBefore: [...queryCursor.endBefore, endBefore], + endBefore: [ + ...queryCursor.endBefore, + _$SimpleFreezedPerFieldToJson.a(endBefore as int) + ], endBeforeDocumentSnapshot: null, ); } diff --git a/packages/cloud_firestore_odm_generator/cloud_firestore_odm_generator_integration_test/lib/simple.g.dart b/packages/cloud_firestore_odm_generator/cloud_firestore_odm_generator_integration_test/lib/simple.g.dart index e4b949b..031de0c 100644 --- a/packages/cloud_firestore_odm_generator/cloud_firestore_odm_generator_integration_test/lib/simple.g.dart +++ b/packages/cloud_firestore_odm_generator/cloud_firestore_odm_generator_integration_test/lib/simple.g.dart @@ -258,7 +258,11 @@ class _$IgnoredGetterDocumentReference extends FirestoreDocumentReference< _$IgnoredGetterFieldMap['value']!: valueFieldValue, }; - transaction.set(reference, json, options); + final castedReference = reference.withConverter>( + fromFirestore: (snapshot, options) => throw UnimplementedError(), + toFirestore: (value, options) => value, + ); + transaction.set(castedReference, json, options); } void batchSet( @@ -273,7 +277,11 @@ class _$IgnoredGetterDocumentReference extends FirestoreDocumentReference< _$IgnoredGetterFieldMap['value']!: valueFieldValue, }; - batch.set(reference, json, options); + final castedReference = reference.withConverter>( + fromFirestore: (snapshot, options) => throw UnimplementedError(), + toFirestore: (value, options) => value, + ); + batch.set(castedReference, json, options); } Future update({ @@ -819,25 +827,37 @@ class _$IgnoredGetterQuery if (startAt != _sentinel) { queryCursor = queryCursor.copyWith( - startAt: [...queryCursor.startAt, startAt], + startAt: [ + ...queryCursor.startAt, + _$IgnoredGetterPerFieldToJson.value(startAt as int) + ], startAtDocumentSnapshot: null, ); } if (startAfter != _sentinel) { queryCursor = queryCursor.copyWith( - startAfter: [...queryCursor.startAfter, startAfter], + startAfter: [ + ...queryCursor.startAfter, + _$IgnoredGetterPerFieldToJson.value(startAfter as int) + ], startAfterDocumentSnapshot: null, ); } if (endAt != _sentinel) { queryCursor = queryCursor.copyWith( - endAt: [...queryCursor.endAt, endAt], + endAt: [ + ...queryCursor.endAt, + _$IgnoredGetterPerFieldToJson.value(endAt as int) + ], endAtDocumentSnapshot: null, ); } if (endBefore != _sentinel) { queryCursor = queryCursor.copyWith( - endBefore: [...queryCursor.endBefore, endBefore], + endBefore: [ + ...queryCursor.endBefore, + _$IgnoredGetterPerFieldToJson.value(endBefore as int) + ], endBeforeDocumentSnapshot: null, ); } @@ -1178,7 +1198,11 @@ class _$ModelDocumentReference if (valueFieldValue != null) _$ModelFieldMap['value']!: valueFieldValue, }; - transaction.set(reference, json, options); + final castedReference = reference.withConverter>( + fromFirestore: (snapshot, options) => throw UnimplementedError(), + toFirestore: (value, options) => value, + ); + transaction.set(castedReference, json, options); } void batchSet( @@ -1192,7 +1216,11 @@ class _$ModelDocumentReference if (valueFieldValue != null) _$ModelFieldMap['value']!: valueFieldValue, }; - batch.set(reference, json, options); + final castedReference = reference.withConverter>( + fromFirestore: (snapshot, options) => throw UnimplementedError(), + toFirestore: (value, options) => value, + ); + batch.set(castedReference, json, options); } Future update({ @@ -1725,25 +1753,37 @@ class _$ModelQuery extends QueryReference if (startAt != _sentinel) { queryCursor = queryCursor.copyWith( - startAt: [...queryCursor.startAt, startAt], + startAt: [ + ...queryCursor.startAt, + _$ModelPerFieldToJson.value(startAt as String) + ], startAtDocumentSnapshot: null, ); } if (startAfter != _sentinel) { queryCursor = queryCursor.copyWith( - startAfter: [...queryCursor.startAfter, startAfter], + startAfter: [ + ...queryCursor.startAfter, + _$ModelPerFieldToJson.value(startAfter as String) + ], startAfterDocumentSnapshot: null, ); } if (endAt != _sentinel) { queryCursor = queryCursor.copyWith( - endAt: [...queryCursor.endAt, endAt], + endAt: [ + ...queryCursor.endAt, + _$ModelPerFieldToJson.value(endAt as String) + ], endAtDocumentSnapshot: null, ); } if (endBefore != _sentinel) { queryCursor = queryCursor.copyWith( - endBefore: [...queryCursor.endBefore, endBefore], + endBefore: [ + ...queryCursor.endBefore, + _$ModelPerFieldToJson.value(endBefore as String) + ], endBeforeDocumentSnapshot: null, ); } @@ -2261,7 +2301,11 @@ class _$NestedDocumentReference _$NestedFieldMap['nullableEnumList']!: nullableEnumListFieldValue, }; - transaction.set(reference, json, options); + final castedReference = reference.withConverter>( + fromFirestore: (snapshot, options) => throw UnimplementedError(), + toFirestore: (value, options) => value, + ); + transaction.set(castedReference, json, options); } void batchSet( @@ -2311,7 +2355,11 @@ class _$NestedDocumentReference _$NestedFieldMap['nullableEnumList']!: nullableEnumListFieldValue, }; - batch.set(reference, json, options); + final castedReference = reference.withConverter>( + fromFirestore: (snapshot, options) => throw UnimplementedError(), + toFirestore: (value, options) => value, + ); + batch.set(castedReference, json, options); } Future update({ @@ -4149,25 +4197,37 @@ class _$NestedQuery extends QueryReference if (startAt != _sentinel) { queryCursor = queryCursor.copyWith( - startAt: [...queryCursor.startAt, startAt], + startAt: [ + ...queryCursor.startAt, + _$NestedPerFieldToJson.value(startAt as Nested?) + ], startAtDocumentSnapshot: null, ); } if (startAfter != _sentinel) { queryCursor = queryCursor.copyWith( - startAfter: [...queryCursor.startAfter, startAfter], + startAfter: [ + ...queryCursor.startAfter, + _$NestedPerFieldToJson.value(startAfter as Nested?) + ], startAfterDocumentSnapshot: null, ); } if (endAt != _sentinel) { queryCursor = queryCursor.copyWith( - endAt: [...queryCursor.endAt, endAt], + endAt: [ + ...queryCursor.endAt, + _$NestedPerFieldToJson.value(endAt as Nested?) + ], endAtDocumentSnapshot: null, ); } if (endBefore != _sentinel) { queryCursor = queryCursor.copyWith( - endBefore: [...queryCursor.endBefore, endBefore], + endBefore: [ + ...queryCursor.endBefore, + _$NestedPerFieldToJson.value(endBefore as Nested?) + ], endBeforeDocumentSnapshot: null, ); } @@ -4222,25 +4282,37 @@ class _$NestedQuery extends QueryReference if (startAt != _sentinel) { queryCursor = queryCursor.copyWith( - startAt: [...queryCursor.startAt, startAt], + startAt: [ + ...queryCursor.startAt, + _$NestedPerFieldToJson.simple(startAt as int?) + ], startAtDocumentSnapshot: null, ); } if (startAfter != _sentinel) { queryCursor = queryCursor.copyWith( - startAfter: [...queryCursor.startAfter, startAfter], + startAfter: [ + ...queryCursor.startAfter, + _$NestedPerFieldToJson.simple(startAfter as int?) + ], startAfterDocumentSnapshot: null, ); } if (endAt != _sentinel) { queryCursor = queryCursor.copyWith( - endAt: [...queryCursor.endAt, endAt], + endAt: [ + ...queryCursor.endAt, + _$NestedPerFieldToJson.simple(endAt as int?) + ], endAtDocumentSnapshot: null, ); } if (endBefore != _sentinel) { queryCursor = queryCursor.copyWith( - endBefore: [...queryCursor.endBefore, endBefore], + endBefore: [ + ...queryCursor.endBefore, + _$NestedPerFieldToJson.simple(endBefore as int?) + ], endBeforeDocumentSnapshot: null, ); } @@ -4295,25 +4367,37 @@ class _$NestedQuery extends QueryReference if (startAt != _sentinel) { queryCursor = queryCursor.copyWith( - startAt: [...queryCursor.startAt, startAt], + startAt: [ + ...queryCursor.startAt, + _$NestedPerFieldToJson.valueList(startAt as List?) + ], startAtDocumentSnapshot: null, ); } if (startAfter != _sentinel) { queryCursor = queryCursor.copyWith( - startAfter: [...queryCursor.startAfter, startAfter], + startAfter: [ + ...queryCursor.startAfter, + _$NestedPerFieldToJson.valueList(startAfter as List?) + ], startAfterDocumentSnapshot: null, ); } if (endAt != _sentinel) { queryCursor = queryCursor.copyWith( - endAt: [...queryCursor.endAt, endAt], + endAt: [ + ...queryCursor.endAt, + _$NestedPerFieldToJson.valueList(endAt as List?) + ], endAtDocumentSnapshot: null, ); } if (endBefore != _sentinel) { queryCursor = queryCursor.copyWith( - endBefore: [...queryCursor.endBefore, endBefore], + endBefore: [ + ...queryCursor.endBefore, + _$NestedPerFieldToJson.valueList(endBefore as List?) + ], endBeforeDocumentSnapshot: null, ); } @@ -4368,25 +4452,37 @@ class _$NestedQuery extends QueryReference if (startAt != _sentinel) { queryCursor = queryCursor.copyWith( - startAt: [...queryCursor.startAt, startAt], + startAt: [ + ...queryCursor.startAt, + _$NestedPerFieldToJson.boolList(startAt as List?) + ], startAtDocumentSnapshot: null, ); } if (startAfter != _sentinel) { queryCursor = queryCursor.copyWith( - startAfter: [...queryCursor.startAfter, startAfter], + startAfter: [ + ...queryCursor.startAfter, + _$NestedPerFieldToJson.boolList(startAfter as List?) + ], startAfterDocumentSnapshot: null, ); } if (endAt != _sentinel) { queryCursor = queryCursor.copyWith( - endAt: [...queryCursor.endAt, endAt], + endAt: [ + ...queryCursor.endAt, + _$NestedPerFieldToJson.boolList(endAt as List?) + ], endAtDocumentSnapshot: null, ); } if (endBefore != _sentinel) { queryCursor = queryCursor.copyWith( - endBefore: [...queryCursor.endBefore, endBefore], + endBefore: [ + ...queryCursor.endBefore, + _$NestedPerFieldToJson.boolList(endBefore as List?) + ], endBeforeDocumentSnapshot: null, ); } @@ -4441,25 +4537,37 @@ class _$NestedQuery extends QueryReference if (startAt != _sentinel) { queryCursor = queryCursor.copyWith( - startAt: [...queryCursor.startAt, startAt], + startAt: [ + ...queryCursor.startAt, + _$NestedPerFieldToJson.stringList(startAt as List?) + ], startAtDocumentSnapshot: null, ); } if (startAfter != _sentinel) { queryCursor = queryCursor.copyWith( - startAfter: [...queryCursor.startAfter, startAfter], + startAfter: [ + ...queryCursor.startAfter, + _$NestedPerFieldToJson.stringList(startAfter as List?) + ], startAfterDocumentSnapshot: null, ); } if (endAt != _sentinel) { queryCursor = queryCursor.copyWith( - endAt: [...queryCursor.endAt, endAt], + endAt: [ + ...queryCursor.endAt, + _$NestedPerFieldToJson.stringList(endAt as List?) + ], endAtDocumentSnapshot: null, ); } if (endBefore != _sentinel) { queryCursor = queryCursor.copyWith( - endBefore: [...queryCursor.endBefore, endBefore], + endBefore: [ + ...queryCursor.endBefore, + _$NestedPerFieldToJson.stringList(endBefore as List?) + ], endBeforeDocumentSnapshot: null, ); } @@ -4514,25 +4622,37 @@ class _$NestedQuery extends QueryReference if (startAt != _sentinel) { queryCursor = queryCursor.copyWith( - startAt: [...queryCursor.startAt, startAt], + startAt: [ + ...queryCursor.startAt, + _$NestedPerFieldToJson.numList(startAt as List?) + ], startAtDocumentSnapshot: null, ); } if (startAfter != _sentinel) { queryCursor = queryCursor.copyWith( - startAfter: [...queryCursor.startAfter, startAfter], + startAfter: [ + ...queryCursor.startAfter, + _$NestedPerFieldToJson.numList(startAfter as List?) + ], startAfterDocumentSnapshot: null, ); } if (endAt != _sentinel) { queryCursor = queryCursor.copyWith( - endAt: [...queryCursor.endAt, endAt], + endAt: [ + ...queryCursor.endAt, + _$NestedPerFieldToJson.numList(endAt as List?) + ], endAtDocumentSnapshot: null, ); } if (endBefore != _sentinel) { queryCursor = queryCursor.copyWith( - endBefore: [...queryCursor.endBefore, endBefore], + endBefore: [ + ...queryCursor.endBefore, + _$NestedPerFieldToJson.numList(endBefore as List?) + ], endBeforeDocumentSnapshot: null, ); } @@ -4587,25 +4707,37 @@ class _$NestedQuery extends QueryReference if (startAt != _sentinel) { queryCursor = queryCursor.copyWith( - startAt: [...queryCursor.startAt, startAt], + startAt: [ + ...queryCursor.startAt, + _$NestedPerFieldToJson.objectList(startAt as List?) + ], startAtDocumentSnapshot: null, ); } if (startAfter != _sentinel) { queryCursor = queryCursor.copyWith( - startAfter: [...queryCursor.startAfter, startAfter], + startAfter: [ + ...queryCursor.startAfter, + _$NestedPerFieldToJson.objectList(startAfter as List?) + ], startAfterDocumentSnapshot: null, ); } if (endAt != _sentinel) { queryCursor = queryCursor.copyWith( - endAt: [...queryCursor.endAt, endAt], + endAt: [ + ...queryCursor.endAt, + _$NestedPerFieldToJson.objectList(endAt as List?) + ], endAtDocumentSnapshot: null, ); } if (endBefore != _sentinel) { queryCursor = queryCursor.copyWith( - endBefore: [...queryCursor.endBefore, endBefore], + endBefore: [ + ...queryCursor.endBefore, + _$NestedPerFieldToJson.objectList(endBefore as List?) + ], endBeforeDocumentSnapshot: null, ); } @@ -4660,25 +4792,37 @@ class _$NestedQuery extends QueryReference if (startAt != _sentinel) { queryCursor = queryCursor.copyWith( - startAt: [...queryCursor.startAt, startAt], + startAt: [ + ...queryCursor.startAt, + _$NestedPerFieldToJson.dynamicList(startAt as List?) + ], startAtDocumentSnapshot: null, ); } if (startAfter != _sentinel) { queryCursor = queryCursor.copyWith( - startAfter: [...queryCursor.startAfter, startAfter], + startAfter: [ + ...queryCursor.startAfter, + _$NestedPerFieldToJson.dynamicList(startAfter as List?) + ], startAfterDocumentSnapshot: null, ); } if (endAt != _sentinel) { queryCursor = queryCursor.copyWith( - endAt: [...queryCursor.endAt, endAt], + endAt: [ + ...queryCursor.endAt, + _$NestedPerFieldToJson.dynamicList(endAt as List?) + ], endAtDocumentSnapshot: null, ); } if (endBefore != _sentinel) { queryCursor = queryCursor.copyWith( - endBefore: [...queryCursor.endBefore, endBefore], + endBefore: [ + ...queryCursor.endBefore, + _$NestedPerFieldToJson.dynamicList(endBefore as List?) + ], endBeforeDocumentSnapshot: null, ); } @@ -4733,25 +4877,37 @@ class _$NestedQuery extends QueryReference if (startAt != _sentinel) { queryCursor = queryCursor.copyWith( - startAt: [...queryCursor.startAt, startAt], + startAt: [ + ...queryCursor.startAt, + _$NestedPerFieldToJson.boolSet(startAt as Set?) + ], startAtDocumentSnapshot: null, ); } if (startAfter != _sentinel) { queryCursor = queryCursor.copyWith( - startAfter: [...queryCursor.startAfter, startAfter], + startAfter: [ + ...queryCursor.startAfter, + _$NestedPerFieldToJson.boolSet(startAfter as Set?) + ], startAfterDocumentSnapshot: null, ); } if (endAt != _sentinel) { queryCursor = queryCursor.copyWith( - endAt: [...queryCursor.endAt, endAt], + endAt: [ + ...queryCursor.endAt, + _$NestedPerFieldToJson.boolSet(endAt as Set?) + ], endAtDocumentSnapshot: null, ); } if (endBefore != _sentinel) { queryCursor = queryCursor.copyWith( - endBefore: [...queryCursor.endBefore, endBefore], + endBefore: [ + ...queryCursor.endBefore, + _$NestedPerFieldToJson.boolSet(endBefore as Set?) + ], endBeforeDocumentSnapshot: null, ); } @@ -4806,25 +4962,37 @@ class _$NestedQuery extends QueryReference if (startAt != _sentinel) { queryCursor = queryCursor.copyWith( - startAt: [...queryCursor.startAt, startAt], + startAt: [ + ...queryCursor.startAt, + _$NestedPerFieldToJson.enumValue(startAt as TestEnum) + ], startAtDocumentSnapshot: null, ); } if (startAfter != _sentinel) { queryCursor = queryCursor.copyWith( - startAfter: [...queryCursor.startAfter, startAfter], + startAfter: [ + ...queryCursor.startAfter, + _$NestedPerFieldToJson.enumValue(startAfter as TestEnum) + ], startAfterDocumentSnapshot: null, ); } if (endAt != _sentinel) { queryCursor = queryCursor.copyWith( - endAt: [...queryCursor.endAt, endAt], + endAt: [ + ...queryCursor.endAt, + _$NestedPerFieldToJson.enumValue(endAt as TestEnum) + ], endAtDocumentSnapshot: null, ); } if (endBefore != _sentinel) { queryCursor = queryCursor.copyWith( - endBefore: [...queryCursor.endBefore, endBefore], + endBefore: [ + ...queryCursor.endBefore, + _$NestedPerFieldToJson.enumValue(endBefore as TestEnum) + ], endBeforeDocumentSnapshot: null, ); } @@ -4880,25 +5048,37 @@ class _$NestedQuery extends QueryReference if (startAt != _sentinel) { queryCursor = queryCursor.copyWith( - startAt: [...queryCursor.startAt, startAt], + startAt: [ + ...queryCursor.startAt, + _$NestedPerFieldToJson.nullableEnumValue(startAt as TestEnum?) + ], startAtDocumentSnapshot: null, ); } if (startAfter != _sentinel) { queryCursor = queryCursor.copyWith( - startAfter: [...queryCursor.startAfter, startAfter], + startAfter: [ + ...queryCursor.startAfter, + _$NestedPerFieldToJson.nullableEnumValue(startAfter as TestEnum?) + ], startAfterDocumentSnapshot: null, ); } if (endAt != _sentinel) { queryCursor = queryCursor.copyWith( - endAt: [...queryCursor.endAt, endAt], + endAt: [ + ...queryCursor.endAt, + _$NestedPerFieldToJson.nullableEnumValue(endAt as TestEnum?) + ], endAtDocumentSnapshot: null, ); } if (endBefore != _sentinel) { queryCursor = queryCursor.copyWith( - endBefore: [...queryCursor.endBefore, endBefore], + endBefore: [ + ...queryCursor.endBefore, + _$NestedPerFieldToJson.nullableEnumValue(endBefore as TestEnum?) + ], endBeforeDocumentSnapshot: null, ); } @@ -4953,25 +5133,37 @@ class _$NestedQuery extends QueryReference if (startAt != _sentinel) { queryCursor = queryCursor.copyWith( - startAt: [...queryCursor.startAt, startAt], + startAt: [ + ...queryCursor.startAt, + _$NestedPerFieldToJson.enumList(startAt as List) + ], startAtDocumentSnapshot: null, ); } if (startAfter != _sentinel) { queryCursor = queryCursor.copyWith( - startAfter: [...queryCursor.startAfter, startAfter], + startAfter: [ + ...queryCursor.startAfter, + _$NestedPerFieldToJson.enumList(startAfter as List) + ], startAfterDocumentSnapshot: null, ); } if (endAt != _sentinel) { queryCursor = queryCursor.copyWith( - endAt: [...queryCursor.endAt, endAt], + endAt: [ + ...queryCursor.endAt, + _$NestedPerFieldToJson.enumList(endAt as List) + ], endAtDocumentSnapshot: null, ); } if (endBefore != _sentinel) { queryCursor = queryCursor.copyWith( - endBefore: [...queryCursor.endBefore, endBefore], + endBefore: [ + ...queryCursor.endBefore, + _$NestedPerFieldToJson.enumList(endBefore as List) + ], endBeforeDocumentSnapshot: null, ); } @@ -5026,25 +5218,37 @@ class _$NestedQuery extends QueryReference if (startAt != _sentinel) { queryCursor = queryCursor.copyWith( - startAt: [...queryCursor.startAt, startAt], + startAt: [ + ...queryCursor.startAt, + _$NestedPerFieldToJson.nullableEnumList(startAt as List?) + ], startAtDocumentSnapshot: null, ); } if (startAfter != _sentinel) { queryCursor = queryCursor.copyWith( - startAfter: [...queryCursor.startAfter, startAfter], + startAfter: [ + ...queryCursor.startAfter, + _$NestedPerFieldToJson.nullableEnumList(startAfter as List?) + ], startAfterDocumentSnapshot: null, ); } if (endAt != _sentinel) { queryCursor = queryCursor.copyWith( - endAt: [...queryCursor.endAt, endAt], + endAt: [ + ...queryCursor.endAt, + _$NestedPerFieldToJson.nullableEnumList(endAt as List?) + ], endAtDocumentSnapshot: null, ); } if (endBefore != _sentinel) { queryCursor = queryCursor.copyWith( - endBefore: [...queryCursor.endBefore, endBefore], + endBefore: [ + ...queryCursor.endBefore, + _$NestedPerFieldToJson.nullableEnumList(endBefore as List?) + ], endBeforeDocumentSnapshot: null, ); } @@ -5989,7 +6193,11 @@ class _$OptionalJsonDocumentReference extends FirestoreDocumentReference< _$OptionalJsonFieldMap['value']!: valueFieldValue, }; - transaction.set(reference, json, options); + final castedReference = reference.withConverter>( + fromFirestore: (snapshot, options) => throw UnimplementedError(), + toFirestore: (value, options) => value, + ); + transaction.set(castedReference, json, options); } void batchSet( @@ -6004,7 +6212,11 @@ class _$OptionalJsonDocumentReference extends FirestoreDocumentReference< _$OptionalJsonFieldMap['value']!: valueFieldValue, }; - batch.set(reference, json, options); + final castedReference = reference.withConverter>( + fromFirestore: (snapshot, options) => throw UnimplementedError(), + toFirestore: (value, options) => value, + ); + batch.set(castedReference, json, options); } Future update({ @@ -6550,25 +6762,37 @@ class _$OptionalJsonQuery if (startAt != _sentinel) { queryCursor = queryCursor.copyWith( - startAt: [...queryCursor.startAt, startAt], + startAt: [ + ...queryCursor.startAt, + _$OptionalJsonPerFieldToJson.value(startAt as int) + ], startAtDocumentSnapshot: null, ); } if (startAfter != _sentinel) { queryCursor = queryCursor.copyWith( - startAfter: [...queryCursor.startAfter, startAfter], + startAfter: [ + ...queryCursor.startAfter, + _$OptionalJsonPerFieldToJson.value(startAfter as int) + ], startAfterDocumentSnapshot: null, ); } if (endAt != _sentinel) { queryCursor = queryCursor.copyWith( - endAt: [...queryCursor.endAt, endAt], + endAt: [ + ...queryCursor.endAt, + _$OptionalJsonPerFieldToJson.value(endAt as int) + ], endAtDocumentSnapshot: null, ); } if (endBefore != _sentinel) { queryCursor = queryCursor.copyWith( - endBefore: [...queryCursor.endBefore, endBefore], + endBefore: [ + ...queryCursor.endBefore, + _$OptionalJsonPerFieldToJson.value(endBefore as int) + ], endBeforeDocumentSnapshot: null, ); } @@ -6911,7 +7135,11 @@ class _$MixedJsonDocumentReference _$MixedJsonFieldMap['value']!: valueFieldValue, }; - transaction.set(reference, json, options); + final castedReference = reference.withConverter>( + fromFirestore: (snapshot, options) => throw UnimplementedError(), + toFirestore: (value, options) => value, + ); + transaction.set(castedReference, json, options); } void batchSet( @@ -6926,7 +7154,11 @@ class _$MixedJsonDocumentReference _$MixedJsonFieldMap['value']!: valueFieldValue, }; - batch.set(reference, json, options); + final castedReference = reference.withConverter>( + fromFirestore: (snapshot, options) => throw UnimplementedError(), + toFirestore: (value, options) => value, + ); + batch.set(castedReference, json, options); } Future update({ @@ -7468,25 +7700,37 @@ class _$MixedJsonQuery extends QueryReference if (startAt != _sentinel) { queryCursor = queryCursor.copyWith( - startAt: [...queryCursor.startAt, startAt], + startAt: [ + ...queryCursor.startAt, + _$MixedJsonPerFieldToJson.value(startAt as int) + ], startAtDocumentSnapshot: null, ); } if (startAfter != _sentinel) { queryCursor = queryCursor.copyWith( - startAfter: [...queryCursor.startAfter, startAfter], + startAfter: [ + ...queryCursor.startAfter, + _$MixedJsonPerFieldToJson.value(startAfter as int) + ], startAfterDocumentSnapshot: null, ); } if (endAt != _sentinel) { queryCursor = queryCursor.copyWith( - endAt: [...queryCursor.endAt, endAt], + endAt: [ + ...queryCursor.endAt, + _$MixedJsonPerFieldToJson.value(endAt as int) + ], endAtDocumentSnapshot: null, ); } if (endBefore != _sentinel) { queryCursor = queryCursor.copyWith( - endBefore: [...queryCursor.endBefore, endBefore], + endBefore: [ + ...queryCursor.endBefore, + _$MixedJsonPerFieldToJson.value(endBefore as int) + ], endBeforeDocumentSnapshot: null, ); } @@ -7880,7 +8124,11 @@ class _$RootDocumentReference _$RootFieldMap['nullable']!: nullableFieldValue, }; - transaction.set(reference, json, options); + final castedReference = reference.withConverter>( + fromFirestore: (snapshot, options) => throw UnimplementedError(), + toFirestore: (value, options) => value, + ); + transaction.set(castedReference, json, options); } void batchSet( @@ -7898,7 +8146,11 @@ class _$RootDocumentReference _$RootFieldMap['nullable']!: nullableFieldValue, }; - batch.set(reference, json, options); + final castedReference = reference.withConverter>( + fromFirestore: (snapshot, options) => throw UnimplementedError(), + toFirestore: (value, options) => value, + ); + batch.set(castedReference, json, options); } Future update({ @@ -8538,25 +8790,37 @@ class _$RootQuery extends QueryReference if (startAt != _sentinel) { queryCursor = queryCursor.copyWith( - startAt: [...queryCursor.startAt, startAt], + startAt: [ + ...queryCursor.startAt, + _$RootPerFieldToJson.nonNullable(startAt as String) + ], startAtDocumentSnapshot: null, ); } if (startAfter != _sentinel) { queryCursor = queryCursor.copyWith( - startAfter: [...queryCursor.startAfter, startAfter], + startAfter: [ + ...queryCursor.startAfter, + _$RootPerFieldToJson.nonNullable(startAfter as String) + ], startAfterDocumentSnapshot: null, ); } if (endAt != _sentinel) { queryCursor = queryCursor.copyWith( - endAt: [...queryCursor.endAt, endAt], + endAt: [ + ...queryCursor.endAt, + _$RootPerFieldToJson.nonNullable(endAt as String) + ], endAtDocumentSnapshot: null, ); } if (endBefore != _sentinel) { queryCursor = queryCursor.copyWith( - endBefore: [...queryCursor.endBefore, endBefore], + endBefore: [ + ...queryCursor.endBefore, + _$RootPerFieldToJson.nonNullable(endBefore as String) + ], endBeforeDocumentSnapshot: null, ); } @@ -8611,25 +8875,37 @@ class _$RootQuery extends QueryReference if (startAt != _sentinel) { queryCursor = queryCursor.copyWith( - startAt: [...queryCursor.startAt, startAt], + startAt: [ + ...queryCursor.startAt, + _$RootPerFieldToJson.nullable(startAt as int?) + ], startAtDocumentSnapshot: null, ); } if (startAfter != _sentinel) { queryCursor = queryCursor.copyWith( - startAfter: [...queryCursor.startAfter, startAfter], + startAfter: [ + ...queryCursor.startAfter, + _$RootPerFieldToJson.nullable(startAfter as int?) + ], startAfterDocumentSnapshot: null, ); } if (endAt != _sentinel) { queryCursor = queryCursor.copyWith( - endAt: [...queryCursor.endAt, endAt], + endAt: [ + ...queryCursor.endAt, + _$RootPerFieldToJson.nullable(endAt as int?) + ], endAtDocumentSnapshot: null, ); } if (endBefore != _sentinel) { queryCursor = queryCursor.copyWith( - endBefore: [...queryCursor.endBefore, endBefore], + endBefore: [ + ...queryCursor.endBefore, + _$RootPerFieldToJson.nullable(endBefore as int?) + ], endBeforeDocumentSnapshot: null, ); } @@ -8999,7 +9275,11 @@ class _$SubDocumentReference _$SubFieldMap['nullable']!: nullableFieldValue, }; - transaction.set(reference, json, options); + final castedReference = reference.withConverter>( + fromFirestore: (snapshot, options) => throw UnimplementedError(), + toFirestore: (value, options) => value, + ); + transaction.set(castedReference, json, options); } void batchSet( @@ -9017,7 +9297,11 @@ class _$SubDocumentReference _$SubFieldMap['nullable']!: nullableFieldValue, }; - batch.set(reference, json, options); + final castedReference = reference.withConverter>( + fromFirestore: (snapshot, options) => throw UnimplementedError(), + toFirestore: (value, options) => value, + ); + batch.set(castedReference, json, options); } Future update({ @@ -9657,25 +9941,37 @@ class _$SubQuery extends QueryReference if (startAt != _sentinel) { queryCursor = queryCursor.copyWith( - startAt: [...queryCursor.startAt, startAt], + startAt: [ + ...queryCursor.startAt, + _$SubPerFieldToJson.nonNullable(startAt as String) + ], startAtDocumentSnapshot: null, ); } if (startAfter != _sentinel) { queryCursor = queryCursor.copyWith( - startAfter: [...queryCursor.startAfter, startAfter], + startAfter: [ + ...queryCursor.startAfter, + _$SubPerFieldToJson.nonNullable(startAfter as String) + ], startAfterDocumentSnapshot: null, ); } if (endAt != _sentinel) { queryCursor = queryCursor.copyWith( - endAt: [...queryCursor.endAt, endAt], + endAt: [ + ...queryCursor.endAt, + _$SubPerFieldToJson.nonNullable(endAt as String) + ], endAtDocumentSnapshot: null, ); } if (endBefore != _sentinel) { queryCursor = queryCursor.copyWith( - endBefore: [...queryCursor.endBefore, endBefore], + endBefore: [ + ...queryCursor.endBefore, + _$SubPerFieldToJson.nonNullable(endBefore as String) + ], endBeforeDocumentSnapshot: null, ); } @@ -9730,25 +10026,37 @@ class _$SubQuery extends QueryReference if (startAt != _sentinel) { queryCursor = queryCursor.copyWith( - startAt: [...queryCursor.startAt, startAt], + startAt: [ + ...queryCursor.startAt, + _$SubPerFieldToJson.nullable(startAt as int?) + ], startAtDocumentSnapshot: null, ); } if (startAfter != _sentinel) { queryCursor = queryCursor.copyWith( - startAfter: [...queryCursor.startAfter, startAfter], + startAfter: [ + ...queryCursor.startAfter, + _$SubPerFieldToJson.nullable(startAfter as int?) + ], startAfterDocumentSnapshot: null, ); } if (endAt != _sentinel) { queryCursor = queryCursor.copyWith( - endAt: [...queryCursor.endAt, endAt], + endAt: [ + ...queryCursor.endAt, + _$SubPerFieldToJson.nullable(endAt as int?) + ], endAtDocumentSnapshot: null, ); } if (endBefore != _sentinel) { queryCursor = queryCursor.copyWith( - endBefore: [...queryCursor.endBefore, endBefore], + endBefore: [ + ...queryCursor.endBefore, + _$SubPerFieldToJson.nullable(endBefore as int?) + ], endBeforeDocumentSnapshot: null, ); } @@ -10108,7 +10416,11 @@ class _$AsCamelCaseDocumentReference _$AsCamelCaseFieldMap['value']!: valueFieldValue, }; - transaction.set(reference, json, options); + final castedReference = reference.withConverter>( + fromFirestore: (snapshot, options) => throw UnimplementedError(), + toFirestore: (value, options) => value, + ); + transaction.set(castedReference, json, options); } void batchSet( @@ -10123,7 +10435,11 @@ class _$AsCamelCaseDocumentReference _$AsCamelCaseFieldMap['value']!: valueFieldValue, }; - batch.set(reference, json, options); + final castedReference = reference.withConverter>( + fromFirestore: (snapshot, options) => throw UnimplementedError(), + toFirestore: (value, options) => value, + ); + batch.set(castedReference, json, options); } Future update({ @@ -10669,25 +10985,37 @@ class _$AsCamelCaseQuery if (startAt != _sentinel) { queryCursor = queryCursor.copyWith( - startAt: [...queryCursor.startAt, startAt], + startAt: [ + ...queryCursor.startAt, + _$AsCamelCasePerFieldToJson.value(startAt as num) + ], startAtDocumentSnapshot: null, ); } if (startAfter != _sentinel) { queryCursor = queryCursor.copyWith( - startAfter: [...queryCursor.startAfter, startAfter], + startAfter: [ + ...queryCursor.startAfter, + _$AsCamelCasePerFieldToJson.value(startAfter as num) + ], startAfterDocumentSnapshot: null, ); } if (endAt != _sentinel) { queryCursor = queryCursor.copyWith( - endAt: [...queryCursor.endAt, endAt], + endAt: [ + ...queryCursor.endAt, + _$AsCamelCasePerFieldToJson.value(endAt as num) + ], endAtDocumentSnapshot: null, ); } if (endBefore != _sentinel) { queryCursor = queryCursor.copyWith( - endBefore: [...queryCursor.endBefore, endBefore], + endBefore: [ + ...queryCursor.endBefore, + _$AsCamelCasePerFieldToJson.value(endBefore as num) + ], endBeforeDocumentSnapshot: null, ); } @@ -11053,7 +11381,11 @@ class _$CustomSubNameDocumentReference extends FirestoreDocumentReference< _$CustomSubNameFieldMap['value']!: valueFieldValue, }; - transaction.set(reference, json, options); + final castedReference = reference.withConverter>( + fromFirestore: (snapshot, options) => throw UnimplementedError(), + toFirestore: (value, options) => value, + ); + transaction.set(castedReference, json, options); } void batchSet( @@ -11068,7 +11400,11 @@ class _$CustomSubNameDocumentReference extends FirestoreDocumentReference< _$CustomSubNameFieldMap['value']!: valueFieldValue, }; - batch.set(reference, json, options); + final castedReference = reference.withConverter>( + fromFirestore: (snapshot, options) => throw UnimplementedError(), + toFirestore: (value, options) => value, + ); + batch.set(castedReference, json, options); } Future update({ @@ -11614,25 +11950,37 @@ class _$CustomSubNameQuery if (startAt != _sentinel) { queryCursor = queryCursor.copyWith( - startAt: [...queryCursor.startAt, startAt], + startAt: [ + ...queryCursor.startAt, + _$CustomSubNamePerFieldToJson.value(startAt as num) + ], startAtDocumentSnapshot: null, ); } if (startAfter != _sentinel) { queryCursor = queryCursor.copyWith( - startAfter: [...queryCursor.startAfter, startAfter], + startAfter: [ + ...queryCursor.startAfter, + _$CustomSubNamePerFieldToJson.value(startAfter as num) + ], startAfterDocumentSnapshot: null, ); } if (endAt != _sentinel) { queryCursor = queryCursor.copyWith( - endAt: [...queryCursor.endAt, endAt], + endAt: [ + ...queryCursor.endAt, + _$CustomSubNamePerFieldToJson.value(endAt as num) + ], endAtDocumentSnapshot: null, ); } if (endBefore != _sentinel) { queryCursor = queryCursor.copyWith( - endBefore: [...queryCursor.endBefore, endBefore], + endBefore: [ + ...queryCursor.endBefore, + _$CustomSubNamePerFieldToJson.value(endBefore as num) + ], endBeforeDocumentSnapshot: null, ); } @@ -12002,7 +12350,11 @@ class _$ThisIsACustomPrefixDocumentReference extends FirestoreDocumentReference< _$CustomClassPrefixFieldMap['value']!: valueFieldValue, }; - transaction.set(reference, json, options); + final castedReference = reference.withConverter>( + fromFirestore: (snapshot, options) => throw UnimplementedError(), + toFirestore: (value, options) => value, + ); + transaction.set(castedReference, json, options); } void batchSet( @@ -12017,7 +12369,11 @@ class _$ThisIsACustomPrefixDocumentReference extends FirestoreDocumentReference< _$CustomClassPrefixFieldMap['value']!: valueFieldValue, }; - batch.set(reference, json, options); + final castedReference = reference.withConverter>( + fromFirestore: (snapshot, options) => throw UnimplementedError(), + toFirestore: (value, options) => value, + ); + batch.set(castedReference, json, options); } Future update({ @@ -12568,25 +12924,37 @@ class _$ThisIsACustomPrefixQuery if (startAt != _sentinel) { queryCursor = queryCursor.copyWith( - startAt: [...queryCursor.startAt, startAt], + startAt: [ + ...queryCursor.startAt, + _$CustomClassPrefixPerFieldToJson.value(startAt as num) + ], startAtDocumentSnapshot: null, ); } if (startAfter != _sentinel) { queryCursor = queryCursor.copyWith( - startAfter: [...queryCursor.startAfter, startAfter], + startAfter: [ + ...queryCursor.startAfter, + _$CustomClassPrefixPerFieldToJson.value(startAfter as num) + ], startAfterDocumentSnapshot: null, ); } if (endAt != _sentinel) { queryCursor = queryCursor.copyWith( - endAt: [...queryCursor.endAt, endAt], + endAt: [ + ...queryCursor.endAt, + _$CustomClassPrefixPerFieldToJson.value(endAt as num) + ], endAtDocumentSnapshot: null, ); } if (endBefore != _sentinel) { queryCursor = queryCursor.copyWith( - endBefore: [...queryCursor.endBefore, endBefore], + endBefore: [ + ...queryCursor.endBefore, + _$CustomClassPrefixPerFieldToJson.value(endBefore as num) + ], endBeforeDocumentSnapshot: null, ); } @@ -12945,7 +13313,11 @@ class _$ExplicitPathDocumentReference extends FirestoreDocumentReference< _$ExplicitPathFieldMap['value']!: valueFieldValue, }; - transaction.set(reference, json, options); + final castedReference = reference.withConverter>( + fromFirestore: (snapshot, options) => throw UnimplementedError(), + toFirestore: (value, options) => value, + ); + transaction.set(castedReference, json, options); } void batchSet( @@ -12960,7 +13332,11 @@ class _$ExplicitPathDocumentReference extends FirestoreDocumentReference< _$ExplicitPathFieldMap['value']!: valueFieldValue, }; - batch.set(reference, json, options); + final castedReference = reference.withConverter>( + fromFirestore: (snapshot, options) => throw UnimplementedError(), + toFirestore: (value, options) => value, + ); + batch.set(castedReference, json, options); } Future update({ @@ -13506,25 +13882,37 @@ class _$ExplicitPathQuery if (startAt != _sentinel) { queryCursor = queryCursor.copyWith( - startAt: [...queryCursor.startAt, startAt], + startAt: [ + ...queryCursor.startAt, + _$ExplicitPathPerFieldToJson.value(startAt as num) + ], startAtDocumentSnapshot: null, ); } if (startAfter != _sentinel) { queryCursor = queryCursor.copyWith( - startAfter: [...queryCursor.startAfter, startAfter], + startAfter: [ + ...queryCursor.startAfter, + _$ExplicitPathPerFieldToJson.value(startAfter as num) + ], startAfterDocumentSnapshot: null, ); } if (endAt != _sentinel) { queryCursor = queryCursor.copyWith( - endAt: [...queryCursor.endAt, endAt], + endAt: [ + ...queryCursor.endAt, + _$ExplicitPathPerFieldToJson.value(endAt as num) + ], endAtDocumentSnapshot: null, ); } if (endBefore != _sentinel) { queryCursor = queryCursor.copyWith( - endBefore: [...queryCursor.endBefore, endBefore], + endBefore: [ + ...queryCursor.endBefore, + _$ExplicitPathPerFieldToJson.value(endBefore as num) + ], endBeforeDocumentSnapshot: null, ); } @@ -13891,7 +14279,11 @@ class _$ExplicitSubPathDocumentReference extends FirestoreDocumentReference< _$ExplicitSubPathFieldMap['value']!: valueFieldValue, }; - transaction.set(reference, json, options); + final castedReference = reference.withConverter>( + fromFirestore: (snapshot, options) => throw UnimplementedError(), + toFirestore: (value, options) => value, + ); + transaction.set(castedReference, json, options); } void batchSet( @@ -13906,7 +14298,11 @@ class _$ExplicitSubPathDocumentReference extends FirestoreDocumentReference< _$ExplicitSubPathFieldMap['value']!: valueFieldValue, }; - batch.set(reference, json, options); + final castedReference = reference.withConverter>( + fromFirestore: (snapshot, options) => throw UnimplementedError(), + toFirestore: (value, options) => value, + ); + batch.set(castedReference, json, options); } Future update({ @@ -14453,25 +14849,37 @@ class _$ExplicitSubPathQuery if (startAt != _sentinel) { queryCursor = queryCursor.copyWith( - startAt: [...queryCursor.startAt, startAt], + startAt: [ + ...queryCursor.startAt, + _$ExplicitSubPathPerFieldToJson.value(startAt as num) + ], startAtDocumentSnapshot: null, ); } if (startAfter != _sentinel) { queryCursor = queryCursor.copyWith( - startAfter: [...queryCursor.startAfter, startAfter], + startAfter: [ + ...queryCursor.startAfter, + _$ExplicitSubPathPerFieldToJson.value(startAfter as num) + ], startAfterDocumentSnapshot: null, ); } if (endAt != _sentinel) { queryCursor = queryCursor.copyWith( - endAt: [...queryCursor.endAt, endAt], + endAt: [ + ...queryCursor.endAt, + _$ExplicitSubPathPerFieldToJson.value(endAt as num) + ], endAtDocumentSnapshot: null, ); } if (endBefore != _sentinel) { queryCursor = queryCursor.copyWith( - endBefore: [...queryCursor.endBefore, endBefore], + endBefore: [ + ...queryCursor.endBefore, + _$ExplicitSubPathPerFieldToJson.value(endBefore as num) + ], endBeforeDocumentSnapshot: null, ); } @@ -14816,7 +15224,11 @@ class _$SubClassDocumentReference _$SubClassFieldMap['instanceGetter']!: instanceGetterFieldValue, }; - transaction.set(reference, json, options); + final castedReference = reference.withConverter>( + fromFirestore: (snapshot, options) => throw UnimplementedError(), + toFirestore: (value, options) => value, + ); + transaction.set(castedReference, json, options); } void batchSet( @@ -14831,7 +15243,11 @@ class _$SubClassDocumentReference _$SubClassFieldMap['instanceGetter']!: instanceGetterFieldValue, }; - batch.set(reference, json, options); + final castedReference = reference.withConverter>( + fromFirestore: (snapshot, options) => throw UnimplementedError(), + toFirestore: (value, options) => value, + ); + batch.set(castedReference, json, options); } Future update({ @@ -15377,25 +15793,37 @@ class _$SubClassQuery extends QueryReference if (startAt != _sentinel) { queryCursor = queryCursor.copyWith( - startAt: [...queryCursor.startAt, startAt], + startAt: [ + ...queryCursor.startAt, + _$SubClassPerFieldToJson.instanceGetter(startAt as int) + ], startAtDocumentSnapshot: null, ); } if (startAfter != _sentinel) { queryCursor = queryCursor.copyWith( - startAfter: [...queryCursor.startAfter, startAfter], + startAfter: [ + ...queryCursor.startAfter, + _$SubClassPerFieldToJson.instanceGetter(startAfter as int) + ], startAfterDocumentSnapshot: null, ); } if (endAt != _sentinel) { queryCursor = queryCursor.copyWith( - endAt: [...queryCursor.endAt, endAt], + endAt: [ + ...queryCursor.endAt, + _$SubClassPerFieldToJson.instanceGetter(endAt as int) + ], endAtDocumentSnapshot: null, ); } if (endBefore != _sentinel) { queryCursor = queryCursor.copyWith( - endBefore: [...queryCursor.endBefore, endBefore], + endBefore: [ + ...queryCursor.endBefore, + _$SubClassPerFieldToJson.instanceGetter(endBefore as int) + ], endBeforeDocumentSnapshot: null, ); } diff --git a/packages/cloud_firestore_odm_generator/cloud_firestore_odm_generator_integration_test/pubspec.yaml b/packages/cloud_firestore_odm_generator/cloud_firestore_odm_generator_integration_test/pubspec.yaml index f574814..c360b38 100644 --- a/packages/cloud_firestore_odm_generator/cloud_firestore_odm_generator_integration_test/pubspec.yaml +++ b/packages/cloud_firestore_odm_generator/cloud_firestore_odm_generator_integration_test/pubspec.yaml @@ -5,8 +5,8 @@ environment: sdk: ">=3.0.0 <4.0.0" dependencies: - cloud_firestore: ^5.0.2 - cloud_firestore_odm: ^1.1.0 + cloud_firestore: ^6.0.0 + cloud_firestore_odm: ^1.2.0 flutter: sdk: flutter freezed_annotation: ^3.0.0 @@ -22,7 +22,7 @@ dev_dependencies: freezed: ^3.0.2 json_serializable: ^6.9.4 test: ^1.25.1 - firebase_core_platform_interface: ^5.0.0 + firebase_core_platform_interface: ^6.0.0 dependency_overrides: cloud_firestore_odm: diff --git a/packages/cloud_firestore_odm_generator/lib/src/templates/document_reference.dart b/packages/cloud_firestore_odm_generator/lib/src/templates/document_reference.dart index 7f7104a..2975b4b 100644 --- a/packages/cloud_firestore_odm_generator/lib/src/templates/document_reference.dart +++ b/packages/cloud_firestore_odm_generator/lib/src/templates/document_reference.dart @@ -193,12 +193,28 @@ void batchSet( fieldValuesNullable: true, ); final fieldValuesJson = _json(data, includeFields: false); + final json = ''' { ...${data.toJson('model')}, $fieldValuesJson }'''; + final idKey = data.idKey; + + String toFirestoreBody; + if (idKey != null) { + toFirestoreBody = "value..remove('$idKey')"; + } else { + toFirestoreBody = 'value'; + } + + final castedReferenceStr = ''' +reference.withConverter>( + fromFirestore: (snapshot, options) => throw UnimplementedError(), + toFirestore: (value, options) => $toFirestoreBody, +)'''; + return ''' Future set( $type model, { @@ -207,10 +223,7 @@ Future set( }) async { final json = $json; - final castedReference = reference.withConverter>( - fromFirestore: (snapshot, options) => throw UnimplementedError(), - toFirestore: (value, options) => value, - ); + final castedReference = $castedReferenceStr; return castedReference.set(json, options); } @@ -222,7 +235,8 @@ void transactionSet( }) { final json = $json; - transaction.set(reference, json, options); + final castedReference = $castedReferenceStr; + transaction.set(castedReference, json, options); } void batchSet( @@ -233,7 +247,8 @@ void batchSet( }) { final json = $json; - batch.set(reference, json, options); + final castedReference = $castedReferenceStr; + batch.set(castedReference, json, options); } '''; } diff --git a/packages/cloud_firestore_odm_generator/lib/src/templates/query_reference.dart b/packages/cloud_firestore_odm_generator/lib/src/templates/query_reference.dart index 72d9517..d6bcffa 100644 --- a/packages/cloud_firestore_odm_generator/lib/src/templates/query_reference.dart +++ b/packages/cloud_firestore_odm_generator/lib/src/templates/query_reference.dart @@ -149,6 +149,12 @@ class ${data.queryReferenceImplName} if (field.name == 'fieldPath') '${field.type} fieldPath,', ].join(); + String withToJson(String arg) { + return field.name == 'documentId' || field.name == 'fieldPath' + ? arg + : '${data.perFieldToJson(field.name)}($arg as ${field.type})'; + } + buffer.writeln( ''' @override @@ -193,25 +199,25 @@ class ${data.queryReferenceImplName} if (startAt != _sentinel) { queryCursor = queryCursor.copyWith( - startAt: [...queryCursor.startAt, startAt], + startAt: [...queryCursor.startAt, ${withToJson('startAt')}], startAtDocumentSnapshot: null, ); } if (startAfter != _sentinel) { queryCursor = queryCursor.copyWith( - startAfter: [...queryCursor.startAfter, startAfter], + startAfter: [...queryCursor.startAfter, ${withToJson('startAfter')}], startAfterDocumentSnapshot: null, ); } if (endAt != _sentinel) { queryCursor = queryCursor.copyWith( - endAt: [...queryCursor.endAt, endAt], + endAt: [...queryCursor.endAt, ${withToJson('endAt')}], endAtDocumentSnapshot: null, ); } if (endBefore != _sentinel) { queryCursor = queryCursor.copyWith( - endBefore: [...queryCursor.endBefore, endBefore], + endBefore: [...queryCursor.endBefore, ${withToJson('endBefore')}], endBeforeDocumentSnapshot: null, ); } @@ -238,14 +244,12 @@ class ${data.queryReferenceImplName} (match) => match.group(0)!.toUpperCase(), ); - final nullableType = - field.type.nullabilitySuffix == NullabilitySuffix.question - ? '${field.type}' - : '${field.type}?'; + final nullableType = field.type.nullabilitySuffix == NullabilitySuffix.question + ? '${field.type}' + : '${field.type}?'; final nullableWhereType = _WherePrototype.plain(nullableType); - final sentinelObjectWhereType = - _WherePrototype.plain('Object?', '_sentinel'); + final sentinelObjectWhereType = _WherePrototype.plain('Object?', '_sentinel'); final objectWhereType = _WherePrototype.plain('Object?'); final perFieldToJson = data.perFieldToJson(field.name); @@ -322,10 +326,7 @@ class ${data.queryReferenceImplName} map: (name) { final itemType = field.name == 'fieldPath' ? field.type.toString() - : (field.type as InterfaceType) - .typeArguments - .first - .toString(); + : (field.type as InterfaceType).typeArguments.first.toString(); final cast = itemType != 'Object?' ? ' as $itemType' : ''; var transform = '$name != null ? ($perFieldToJson('; @@ -339,8 +340,7 @@ class ${data.queryReferenceImplName} ), 'arrayContainsAny': _WhereMapper( prototype: nullableWhereType, - map: (name) => - '$name != null ? $perFieldToJson($name) as Iterable? : null', + map: (name) => '$name != null ? $perFieldToJson($name) as Iterable? : null', ), } else if (!field.type.isSupportedIterable) ...{ 'whereIn': inMapper, @@ -354,8 +354,7 @@ class ${data.queryReferenceImplName} ), }; - final prototype = - operators.entries.map((e) => e.value.prototype.call(e.key)).join(); + final prototype = operators.entries.map((e) => e.value.prototype.call(e.key)).join(); final parameters = operators.entries.map((entry) { final key = entry.key; diff --git a/packages/cloud_firestore_odm_generator/pubspec.yaml b/packages/cloud_firestore_odm_generator/pubspec.yaml index 0a23742..caa7ec4 100644 --- a/packages/cloud_firestore_odm_generator/pubspec.yaml +++ b/packages/cloud_firestore_odm_generator/pubspec.yaml @@ -2,7 +2,7 @@ name: cloud_firestore_odm_generator description: A code generator for cloud_firestore_odm. homepage: https://firebase.flutter.dev/docs/firestore/odm repository: https://github.com/firebaseextended/firestoreodm-flutter -version: 1.1.0 +version: 1.2.0 environment: sdk: ">=3.0.0 <4.0.0" @@ -11,7 +11,7 @@ dependencies: analyzer: ">=5.12.0 <8.0.0" build: ^2.4.1 build_config: ^1.1.2 - cloud_firestore_odm: ^1.1.0 + cloud_firestore_odm: ^1.2.0 collection: ^1.18.0 freezed_annotation: ^3.0.0 # Can be removed once this is fixed https://github.com/dart-lang/graphs/issues/86 diff --git a/scripts/run-tests.sh b/scripts/run-tests.sh new file mode 100755 index 0000000..49d5368 --- /dev/null +++ b/scripts/run-tests.sh @@ -0,0 +1,22 @@ +cd packages/cloud_firestore_odm_generator/cloud_firestore_odm_generator_integration_test +dart run build_runner build -d +flutter test +cd .. +dart test +cd ../cloud_firestore_odm +flutter test +cd example +dart run build_runner build -d +firebase emulators:start --only firestore & +FIREBASE_EMULATOR_PID=$! + +chromedriver --port=4444 & +CHROMEDRIVER_PID=$! + +flutter drive --driver=test_driver/integration_test.dart --target=integration_test/cloud_firestore_odm_e2e_test.dart -d chrome +kill $CHROMEDRIVER_PID +kill $FIREBASE_EMULATOR_PID + + + + From dfa4066f37c199959f9e4c1e9915ee57a5b4b024 Mon Sep 17 00:00:00 2001 From: dorklein Date: Fri, 29 Aug 2025 16:06:52 +0700 Subject: [PATCH 3/7] chore: Update SDK constraints and dependencies for cloud_firestore_odm and generator - Upgrade Dart SDK constraints to >=3.8.0 <4.0.0 in pubspec.yaml files - Update dependencies in example and generator packages to latest versions - Modify integration tests and example code for compatibility with updated dependencies - Refactor code for improved readability and maintainability --- .../query_reference_test.dart | 68 +- .../example/lib/integration.g.dart | 525 +-- .../example/lib/integration/enums.g.dart | 358 ++- .../lib/integration/freezed.freezed.dart | 1019 +++--- .../example/lib/integration/freezed.g.dart | 345 +- .../lib/integration/named_query.g.dart | 142 +- .../example/lib/integration/query.g.dart | 893 +++--- .../example/lib/movie.g.dart | 551 ++-- .../cloud_firestore_odm/example/pubspec.yaml | 10 +- packages/cloud_firestore_odm/pubspec.yaml | 2 +- .../lib/freezed.dart | 17 +- .../lib/freezed.freezed.dart | 1363 ++++---- .../lib/freezed.g.dart | 514 +-- .../lib/simple.dart | 32 +- .../lib/simple.g.dart | 2833 +++++++++-------- .../pubspec.yaml | 14 +- .../test/collection_test.dart | 8 +- .../test/setup_firestore_mock.dart | 18 +- .../lib/src/collection_data.dart | 168 +- .../lib/src/collection_generator.dart | 50 +- .../lib/src/parse_generator.dart | 61 +- .../lib/src/validator_generator.dart | 20 +- .../pubspec.yaml | 26 +- 23 files changed, 4567 insertions(+), 4470 deletions(-) diff --git a/packages/cloud_firestore_odm/example/integration_test/query_reference_test.dart b/packages/cloud_firestore_odm/example/integration_test/query_reference_test.dart index 19b6a14..4f53142 100644 --- a/packages/cloud_firestore_odm/example/integration_test/query_reference_test.dart +++ b/packages/cloud_firestore_odm/example/integration_test/query_reference_test.dart @@ -2,15 +2,11 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. -import 'dart:typed_data'; - import 'package:cloud_firestore/cloud_firestore.dart'; -import 'package:cloud_firestore_odm_example/integration/named_query.dart'; import 'package:cloud_firestore_odm_example/integration/query.dart'; import 'package:cloud_firestore_odm_example/movie.dart'; import 'package:firebase_core/firebase_core.dart'; import 'package:flutter_test/flutter_test.dart'; -import 'package:http/http.dart' as http; import 'common.dart'; @@ -38,10 +34,7 @@ void main() { MovieCollectionReference().limit(1), MovieCollectionReference(FirebaseFirestore.instance).limit(1), ); - expect( - MovieCollectionReference().limit(1), - isNot(MovieCollectionReference().limit(2)), - ); + expect(MovieCollectionReference().limit(1), isNot(MovieCollectionReference().limit(2))); expect( MovieCollectionReference(customFirestore).limit(1), @@ -145,63 +138,20 @@ void main() { () async { final ref = await initializeTest(documentReferenceRef); - await ref.add( - DocumentReferenceQuery(FirebaseFirestore.instance.doc('foo/a')), - ); - await ref.add( - DocumentReferenceQuery(FirebaseFirestore.instance.doc('foo/b')), - ); - await ref.add( - DocumentReferenceQuery(FirebaseFirestore.instance.doc('foo/c')), - ); + await ref.add(DocumentReferenceQuery(FirebaseFirestore.instance.doc('foo/a'))); + await ref.add(DocumentReferenceQuery(FirebaseFirestore.instance.doc('foo/b'))); + await ref.add(DocumentReferenceQuery(FirebaseFirestore.instance.doc('foo/c'))); - final snapshot = - await ref.orderByRef(startAt: FirebaseFirestore.instance.doc('foo/b')).get(); + final snapshot = await ref + .orderByRef(startAt: FirebaseFirestore.instance.doc('foo/b')) + .get(); expect(snapshot.docs.length, 2); - expect( - snapshot.docs[0].data.ref, - FirebaseFirestore.instance.doc('foo/b'), - ); - expect( - snapshot.docs[1].data.ref, - FirebaseFirestore.instance.doc('foo/c'), - ); + expect(snapshot.docs[0].data.ref, FirebaseFirestore.instance.doc('foo/b')); + expect(snapshot.docs[1].data.ref, FirebaseFirestore.instance.doc('foo/c')); }, skip: 'Blocked by FlutterFire support for querying document references', ); }); - - group('FirebaeFirestore.myCustomNamedQuery()', () { - Future loadBundleSetup() async { - // endpoint serves a bundle with 3 documents each containing - // a 'number' property that increments in value 1-3. - final url = Uri.https('api.rnfirebase.io', '/firestore/bundle-4'); - final response = await http.get(url); - final string = response.body; - return Uint8List.fromList(string.codeUnits); - } - - test('myCustomNamedQuery() successful', () async { - final buffer = await loadBundleSetup(); - final task = FirebaseFirestore.instance.loadBundle(buffer); - - // ensure the bundle has been completely cached - await task.stream.last; - - // namedQuery 'named-bundle-test' which returns a QuerySnaphot of the same 3 documents - // with 'number' property - final snapshot = await FirebaseFirestore.instance.namedBundleTest4Get( - options: const GetOptions(source: Source.cache), - ); - - expect( - snapshot.docs.map((document) => document.data.number), - everyElement(anyOf(1, 2, 3)), - ); - }, - skip: - 'FirebaseError: Tried to deserialize key from different project: react-native-firebase-testing vs flutterfire-e2e-tests'); - }); } diff --git a/packages/cloud_firestore_odm/example/lib/integration.g.dart b/packages/cloud_firestore_odm/example/lib/integration.g.dart index 3ad08ff..d2e9237 100644 --- a/packages/cloud_firestore_odm/example/lib/integration.g.dart +++ b/packages/cloud_firestore_odm/example/lib/integration.g.dart @@ -26,9 +26,8 @@ abstract class AdvancedJsonCollectionReference implements AdvancedJsonQuery, FirestoreCollectionReference { - factory AdvancedJsonCollectionReference([ - FirebaseFirestore? firestore, - ]) = _$AdvancedJsonCollectionReference; + factory AdvancedJsonCollectionReference([FirebaseFirestore? firestore]) = + _$AdvancedJsonCollectionReference; static AdvancedJson fromFirestore( DocumentSnapshot> snapshot, @@ -61,7 +60,9 @@ class _$AdvancedJsonCollectionReference extends _$AdvancedJsonQuery firestore ??= FirebaseFirestore.instance; return _$AdvancedJsonCollectionReference._( - firestore.collection('firestore-example-app/test/advanced').withConverter( + firestore + .collection('firestore-example-app/test/advanced') + .withConverter( fromFirestore: AdvancedJsonCollectionReference.fromFirestore, toFirestore: AdvancedJsonCollectionReference.toFirestore, ), @@ -84,9 +85,7 @@ class _$AdvancedJsonCollectionReference extends _$AdvancedJsonQuery id == null || id.split('/').length == 1, 'The document ID cannot be from a different collection', ); - return AdvancedJsonDocumentReference( - reference.doc(id), - ); + return AdvancedJsonDocumentReference(reference.doc(id)); } @override @@ -107,11 +106,12 @@ class _$AdvancedJsonCollectionReference extends _$AdvancedJsonQuery int get hashCode => Object.hash(runtimeType, reference); } -abstract class AdvancedJsonDocumentReference extends FirestoreDocumentReference< - AdvancedJson, AdvancedJsonDocumentSnapshot> { +abstract class AdvancedJsonDocumentReference + extends + FirestoreDocumentReference { factory AdvancedJsonDocumentReference( - DocumentReference reference) = - _$AdvancedJsonDocumentReference; + DocumentReference reference, + ) = _$AdvancedJsonDocumentReference; DocumentReference get reference; @@ -208,9 +208,10 @@ abstract class AdvancedJsonDocumentReference extends FirestoreDocumentReference< }); } -class _$AdvancedJsonDocumentReference extends FirestoreDocumentReference< - AdvancedJson, - AdvancedJsonDocumentSnapshot> implements AdvancedJsonDocumentReference { +class _$AdvancedJsonDocumentReference + extends + FirestoreDocumentReference + implements AdvancedJsonDocumentReference { _$AdvancedJsonDocumentReference(this.reference); @override @@ -246,6 +247,7 @@ class _$AdvancedJsonDocumentReference extends FirestoreDocumentReference< ...model.toJson(), if (firstNameFieldValue != null) _$AdvancedJsonFieldMap['firstName']!: firstNameFieldValue, + if (lastNameFieldValue != null) _$AdvancedJsonFieldMap['lastName']!: lastNameFieldValue, }; @@ -268,6 +270,7 @@ class _$AdvancedJsonDocumentReference extends FirestoreDocumentReference< ...model.toJson(), if (firstNameFieldValue != null) _$AdvancedJsonFieldMap['firstName']!: firstNameFieldValue, + if (lastNameFieldValue != null) _$AdvancedJsonFieldMap['lastName']!: lastNameFieldValue, }; @@ -290,6 +293,7 @@ class _$AdvancedJsonDocumentReference extends FirestoreDocumentReference< ...model.toJson(), if (firstNameFieldValue != null) _$AdvancedJsonFieldMap['firstName']!: firstNameFieldValue, + if (lastNameFieldValue != null) _$AdvancedJsonFieldMap['lastName']!: lastNameFieldValue, }; @@ -317,13 +321,16 @@ class _$AdvancedJsonDocumentReference extends FirestoreDocumentReference< ); final json = { if (firstName != _sentinel) - _$AdvancedJsonFieldMap['firstName']!: - _$AdvancedJsonPerFieldToJson.firstName(firstName as String?), + _$AdvancedJsonFieldMap['firstName']!: _$AdvancedJsonPerFieldToJson + .firstName(firstName as String?), + if (firstNameFieldValue != null) _$AdvancedJsonFieldMap['firstName']!: firstNameFieldValue, + if (lastName != _sentinel) - _$AdvancedJsonFieldMap['lastName']!: - _$AdvancedJsonPerFieldToJson.lastName(lastName as String?), + _$AdvancedJsonFieldMap['lastName']!: _$AdvancedJsonPerFieldToJson + .lastName(lastName as String?), + if (lastNameFieldValue != null) _$AdvancedJsonFieldMap['lastName']!: lastNameFieldValue, }; @@ -348,13 +355,16 @@ class _$AdvancedJsonDocumentReference extends FirestoreDocumentReference< ); final json = { if (firstName != _sentinel) - _$AdvancedJsonFieldMap['firstName']!: - _$AdvancedJsonPerFieldToJson.firstName(firstName as String?), + _$AdvancedJsonFieldMap['firstName']!: _$AdvancedJsonPerFieldToJson + .firstName(firstName as String?), + if (firstNameFieldValue != null) _$AdvancedJsonFieldMap['firstName']!: firstNameFieldValue, + if (lastName != _sentinel) - _$AdvancedJsonFieldMap['lastName']!: - _$AdvancedJsonPerFieldToJson.lastName(lastName as String?), + _$AdvancedJsonFieldMap['lastName']!: _$AdvancedJsonPerFieldToJson + .lastName(lastName as String?), + if (lastNameFieldValue != null) _$AdvancedJsonFieldMap['lastName']!: lastNameFieldValue, }; @@ -379,13 +389,16 @@ class _$AdvancedJsonDocumentReference extends FirestoreDocumentReference< ); final json = { if (firstName != _sentinel) - _$AdvancedJsonFieldMap['firstName']!: - _$AdvancedJsonPerFieldToJson.firstName(firstName as String?), + _$AdvancedJsonFieldMap['firstName']!: _$AdvancedJsonPerFieldToJson + .firstName(firstName as String?), + if (firstNameFieldValue != null) _$AdvancedJsonFieldMap['firstName']!: firstNameFieldValue, + if (lastName != _sentinel) - _$AdvancedJsonFieldMap['lastName']!: - _$AdvancedJsonPerFieldToJson.lastName(lastName as String?), + _$AdvancedJsonFieldMap['lastName']!: _$AdvancedJsonPerFieldToJson + .lastName(lastName as String?), + if (lastNameFieldValue != null) _$AdvancedJsonFieldMap['lastName']!: lastNameFieldValue, }; @@ -559,17 +572,17 @@ class _$AdvancedJsonQuery required Query $referenceWithoutCursor, $QueryCursor $queryCursor = const $QueryCursor(), }) : super( - $referenceWithoutCursor: $referenceWithoutCursor, - $queryCursor: $queryCursor, - ); + $referenceWithoutCursor: $referenceWithoutCursor, + $queryCursor: $queryCursor, + ); final CollectionReference _collection; @override Stream snapshots([SnapshotOptions? options]) { - return reference - .snapshots() - .map(AdvancedJsonQuerySnapshot._fromQuerySnapshot); + return reference.snapshots().map( + AdvancedJsonQuerySnapshot._fromQuerySnapshot, + ); } @override @@ -626,7 +639,8 @@ class _$AdvancedJsonQuery arrayContainsAny: arrayContainsAny, whereIn: whereIn, whereNotIn: whereNotIn, - isNull: isNull ?? + isNull: + isNull ?? (isEqualTo == null ? false : null) ?? (isNotEqualTo == null ? true : null), ), @@ -658,7 +672,8 @@ class _$AdvancedJsonQuery isGreaterThanOrEqualTo: isGreaterThanOrEqualTo, whereIn: whereIn, whereNotIn: whereNotIn, - isNull: isNull ?? + isNull: + isNull ?? (isEqualTo == null ? false : null) ?? (isNotEqualTo == null ? true : null), ), @@ -692,20 +707,24 @@ class _$AdvancedJsonQuery ? _$AdvancedJsonPerFieldToJson.firstName(isLessThan as String?) : null, isLessThanOrEqualTo: isLessThanOrEqualTo != null - ? _$AdvancedJsonPerFieldToJson - .firstName(isLessThanOrEqualTo as String?) + ? _$AdvancedJsonPerFieldToJson.firstName( + isLessThanOrEqualTo as String?, + ) : null, isGreaterThan: isGreaterThan != null ? _$AdvancedJsonPerFieldToJson.firstName(isGreaterThan as String?) : null, isGreaterThanOrEqualTo: isGreaterThanOrEqualTo != null - ? _$AdvancedJsonPerFieldToJson - .firstName(isGreaterThanOrEqualTo as String?) + ? _$AdvancedJsonPerFieldToJson.firstName( + isGreaterThanOrEqualTo as String?, + ) : null, whereIn: whereIn?.map((e) => _$AdvancedJsonPerFieldToJson.firstName(e)), - whereNotIn: - whereNotIn?.map((e) => _$AdvancedJsonPerFieldToJson.firstName(e)), - isNull: isNull ?? + whereNotIn: whereNotIn?.map( + (e) => _$AdvancedJsonPerFieldToJson.firstName(e), + ), + isNull: + isNull ?? (isEqualTo == null ? false : null) ?? (isNotEqualTo == null ? true : null), ), @@ -739,20 +758,24 @@ class _$AdvancedJsonQuery ? _$AdvancedJsonPerFieldToJson.lastName(isLessThan as String?) : null, isLessThanOrEqualTo: isLessThanOrEqualTo != null - ? _$AdvancedJsonPerFieldToJson - .lastName(isLessThanOrEqualTo as String?) + ? _$AdvancedJsonPerFieldToJson.lastName( + isLessThanOrEqualTo as String?, + ) : null, isGreaterThan: isGreaterThan != null ? _$AdvancedJsonPerFieldToJson.lastName(isGreaterThan as String?) : null, isGreaterThanOrEqualTo: isGreaterThanOrEqualTo != null - ? _$AdvancedJsonPerFieldToJson - .lastName(isGreaterThanOrEqualTo as String?) + ? _$AdvancedJsonPerFieldToJson.lastName( + isGreaterThanOrEqualTo as String?, + ) : null, whereIn: whereIn?.map((e) => _$AdvancedJsonPerFieldToJson.lastName(e)), - whereNotIn: - whereNotIn?.map((e) => _$AdvancedJsonPerFieldToJson.lastName(e)), - isNull: isNull ?? + whereNotIn: whereNotIn?.map( + (e) => _$AdvancedJsonPerFieldToJson.lastName(e), + ), + isNull: + isNull ?? (isEqualTo == null ? false : null) ?? (isNotEqualTo == null ? true : null), ), @@ -773,8 +796,10 @@ class _$AdvancedJsonQuery AdvancedJsonDocumentSnapshot? endBeforeDocument, AdvancedJsonDocumentSnapshot? startAfterDocument, }) { - final query = - $referenceWithoutCursor.orderBy(fieldPath, descending: descending); + final query = $referenceWithoutCursor.orderBy( + fieldPath, + descending: descending, + ); var queryCursor = $queryCursor; if (startAtDocument != null) { @@ -846,8 +871,10 @@ class _$AdvancedJsonQuery AdvancedJsonDocumentSnapshot? endBeforeDocument, AdvancedJsonDocumentSnapshot? startAfterDocument, }) { - final query = $referenceWithoutCursor.orderBy(FieldPath.documentId, - descending: descending); + final query = $referenceWithoutCursor.orderBy( + FieldPath.documentId, + descending: descending, + ); var queryCursor = $queryCursor; if (startAtDocument != null) { @@ -919,8 +946,10 @@ class _$AdvancedJsonQuery AdvancedJsonDocumentSnapshot? endBeforeDocument, AdvancedJsonDocumentSnapshot? startAfterDocument, }) { - final query = $referenceWithoutCursor - .orderBy(_$AdvancedJsonFieldMap['firstName']!, descending: descending); + final query = $referenceWithoutCursor.orderBy( + _$AdvancedJsonFieldMap['firstName']!, + descending: descending, + ); var queryCursor = $queryCursor; if (startAtDocument != null) { @@ -952,7 +981,7 @@ class _$AdvancedJsonQuery queryCursor = queryCursor.copyWith( startAt: [ ...queryCursor.startAt, - _$AdvancedJsonPerFieldToJson.firstName(startAt as String?) + _$AdvancedJsonPerFieldToJson.firstName(startAt as String?), ], startAtDocumentSnapshot: null, ); @@ -961,7 +990,7 @@ class _$AdvancedJsonQuery queryCursor = queryCursor.copyWith( startAfter: [ ...queryCursor.startAfter, - _$AdvancedJsonPerFieldToJson.firstName(startAfter as String?) + _$AdvancedJsonPerFieldToJson.firstName(startAfter as String?), ], startAfterDocumentSnapshot: null, ); @@ -970,7 +999,7 @@ class _$AdvancedJsonQuery queryCursor = queryCursor.copyWith( endAt: [ ...queryCursor.endAt, - _$AdvancedJsonPerFieldToJson.firstName(endAt as String?) + _$AdvancedJsonPerFieldToJson.firstName(endAt as String?), ], endAtDocumentSnapshot: null, ); @@ -979,7 +1008,7 @@ class _$AdvancedJsonQuery queryCursor = queryCursor.copyWith( endBefore: [ ...queryCursor.endBefore, - _$AdvancedJsonPerFieldToJson.firstName(endBefore as String?) + _$AdvancedJsonPerFieldToJson.firstName(endBefore as String?), ], endBeforeDocumentSnapshot: null, ); @@ -1004,8 +1033,10 @@ class _$AdvancedJsonQuery AdvancedJsonDocumentSnapshot? endBeforeDocument, AdvancedJsonDocumentSnapshot? startAfterDocument, }) { - final query = $referenceWithoutCursor - .orderBy(_$AdvancedJsonFieldMap['lastName']!, descending: descending); + final query = $referenceWithoutCursor.orderBy( + _$AdvancedJsonFieldMap['lastName']!, + descending: descending, + ); var queryCursor = $queryCursor; if (startAtDocument != null) { @@ -1037,7 +1068,7 @@ class _$AdvancedJsonQuery queryCursor = queryCursor.copyWith( startAt: [ ...queryCursor.startAt, - _$AdvancedJsonPerFieldToJson.lastName(startAt as String?) + _$AdvancedJsonPerFieldToJson.lastName(startAt as String?), ], startAtDocumentSnapshot: null, ); @@ -1046,7 +1077,7 @@ class _$AdvancedJsonQuery queryCursor = queryCursor.copyWith( startAfter: [ ...queryCursor.startAfter, - _$AdvancedJsonPerFieldToJson.lastName(startAfter as String?) + _$AdvancedJsonPerFieldToJson.lastName(startAfter as String?), ], startAfterDocumentSnapshot: null, ); @@ -1055,7 +1086,7 @@ class _$AdvancedJsonQuery queryCursor = queryCursor.copyWith( endAt: [ ...queryCursor.endAt, - _$AdvancedJsonPerFieldToJson.lastName(endAt as String?) + _$AdvancedJsonPerFieldToJson.lastName(endAt as String?), ], endAtDocumentSnapshot: null, ); @@ -1064,7 +1095,7 @@ class _$AdvancedJsonQuery queryCursor = queryCursor.copyWith( endBefore: [ ...queryCursor.endBefore, - _$AdvancedJsonPerFieldToJson.lastName(endBefore as String?) + _$AdvancedJsonPerFieldToJson.lastName(endBefore as String?), ], endBeforeDocumentSnapshot: null, ); @@ -1097,45 +1128,37 @@ class AdvancedJsonDocumentSnapshot @override AdvancedJsonDocumentReference get reference { - return AdvancedJsonDocumentReference( - snapshot.reference, - ); + return AdvancedJsonDocumentReference(snapshot.reference); } @override final AdvancedJson? data; } -class AdvancedJsonQuerySnapshot extends FirestoreQuerySnapshot { - AdvancedJsonQuerySnapshot._( - this.snapshot, - this.docs, - this.docChanges, - ); +class AdvancedJsonQuerySnapshot + extends + FirestoreQuerySnapshot< + AdvancedJson, + AdvancedJsonQueryDocumentSnapshot + > { + AdvancedJsonQuerySnapshot._(this.snapshot, this.docs, this.docChanges); factory AdvancedJsonQuerySnapshot._fromQuerySnapshot( QuerySnapshot snapshot, ) { - final docs = - snapshot.docs.map(AdvancedJsonQueryDocumentSnapshot._).toList(); + final docs = snapshot.docs + .map(AdvancedJsonQueryDocumentSnapshot._) + .toList(); final docChanges = snapshot.docChanges.map((change) { - return _decodeDocumentChange( - change, - AdvancedJsonDocumentSnapshot._, - ); + return _decodeDocumentChange(change, AdvancedJsonDocumentSnapshot._); }).toList(); - return AdvancedJsonQuerySnapshot._( - snapshot, - docs, - docChanges, - ); + return AdvancedJsonQuerySnapshot._(snapshot, docs, docChanges); } static FirestoreDocumentChange - _decodeDocumentChange( + _decodeDocumentChange( DocumentChange docChange, AdvancedJsonDocumentSnapshot Function(DocumentSnapshot doc) decodeDoc, ) { @@ -1179,8 +1202,10 @@ class AdvancedJsonQueryDocumentSnapshot abstract class _PrivateAdvancedJsonCollectionReference implements _PrivateAdvancedJsonQuery, - FirestoreCollectionReference<_PrivateAdvancedJson, - _PrivateAdvancedJsonQuerySnapshot> { + FirestoreCollectionReference< + _PrivateAdvancedJson, + _PrivateAdvancedJsonQuerySnapshot + > { factory _PrivateAdvancedJsonCollectionReference([ FirebaseFirestore? firestore, ]) = _$_PrivateAdvancedJsonCollectionReference; @@ -1213,8 +1238,9 @@ abstract class _PrivateAdvancedJsonCollectionReference class _$_PrivateAdvancedJsonCollectionReference extends _$_PrivateAdvancedJsonQuery implements _PrivateAdvancedJsonCollectionReference { - factory _$_PrivateAdvancedJsonCollectionReference( - [FirebaseFirestore? firestore]) { + factory _$_PrivateAdvancedJsonCollectionReference([ + FirebaseFirestore? firestore, + ]) { firestore ??= FirebaseFirestore.instance; return _$_PrivateAdvancedJsonCollectionReference._( @@ -1244,14 +1270,13 @@ class _$_PrivateAdvancedJsonCollectionReference id == null || id.split('/').length == 1, 'The document ID cannot be from a different collection', ); - return _PrivateAdvancedJsonDocumentReference( - reference.doc(id), - ); + return _PrivateAdvancedJsonDocumentReference(reference.doc(id)); } @override Future<_PrivateAdvancedJsonDocumentReference> add( - _PrivateAdvancedJson value) { + _PrivateAdvancedJson value, + ) { return reference .add(value) .then((ref) => _PrivateAdvancedJsonDocumentReference(ref)); @@ -1269,11 +1294,14 @@ class _$_PrivateAdvancedJsonCollectionReference } abstract class _PrivateAdvancedJsonDocumentReference - extends FirestoreDocumentReference<_PrivateAdvancedJson, - _PrivateAdvancedJsonDocumentSnapshot> { + extends + FirestoreDocumentReference< + _PrivateAdvancedJson, + _PrivateAdvancedJsonDocumentSnapshot + > { factory _PrivateAdvancedJsonDocumentReference( - DocumentReference<_PrivateAdvancedJson> reference) = - _$_PrivateAdvancedJsonDocumentReference; + DocumentReference<_PrivateAdvancedJson> reference, + ) = _$_PrivateAdvancedJsonDocumentReference; DocumentReference<_PrivateAdvancedJson> get reference; @@ -1371,8 +1399,11 @@ abstract class _PrivateAdvancedJsonDocumentReference } class _$_PrivateAdvancedJsonDocumentReference - extends FirestoreDocumentReference<_PrivateAdvancedJson, - _PrivateAdvancedJsonDocumentSnapshot> + extends + FirestoreDocumentReference< + _PrivateAdvancedJson, + _PrivateAdvancedJsonDocumentSnapshot + > implements _PrivateAdvancedJsonDocumentReference { _$_PrivateAdvancedJsonDocumentReference(this.reference); @@ -1396,7 +1427,8 @@ class _$_PrivateAdvancedJsonDocumentReference @override Future<_PrivateAdvancedJsonDocumentSnapshot> transactionGet( - Transaction transaction) { + Transaction transaction, + ) { return transaction .get(reference) .then(_PrivateAdvancedJsonDocumentSnapshot._); @@ -1412,6 +1444,7 @@ class _$_PrivateAdvancedJsonDocumentReference ...model.toJson(), if (firstNameFieldValue != null) _$PrivateAdvancedJsonFieldMap['firstName']!: firstNameFieldValue, + if (lastNameFieldValue != null) _$PrivateAdvancedJsonFieldMap['lastName']!: lastNameFieldValue, }; @@ -1434,6 +1467,7 @@ class _$_PrivateAdvancedJsonDocumentReference ...model.toJson(), if (firstNameFieldValue != null) _$PrivateAdvancedJsonFieldMap['firstName']!: firstNameFieldValue, + if (lastNameFieldValue != null) _$PrivateAdvancedJsonFieldMap['lastName']!: lastNameFieldValue, }; @@ -1456,6 +1490,7 @@ class _$_PrivateAdvancedJsonDocumentReference ...model.toJson(), if (firstNameFieldValue != null) _$PrivateAdvancedJsonFieldMap['firstName']!: firstNameFieldValue, + if (lastNameFieldValue != null) _$PrivateAdvancedJsonFieldMap['lastName']!: lastNameFieldValue, }; @@ -1485,11 +1520,14 @@ class _$_PrivateAdvancedJsonDocumentReference if (firstName != _sentinel) _$PrivateAdvancedJsonFieldMap['firstName']!: _$PrivateAdvancedJsonPerFieldToJson.firstName(firstName as String?), + if (firstNameFieldValue != null) _$PrivateAdvancedJsonFieldMap['firstName']!: firstNameFieldValue, + if (lastName != _sentinel) _$PrivateAdvancedJsonFieldMap['lastName']!: _$PrivateAdvancedJsonPerFieldToJson.lastName(lastName as String?), + if (lastNameFieldValue != null) _$PrivateAdvancedJsonFieldMap['lastName']!: lastNameFieldValue, }; @@ -1516,11 +1554,14 @@ class _$_PrivateAdvancedJsonDocumentReference if (firstName != _sentinel) _$PrivateAdvancedJsonFieldMap['firstName']!: _$PrivateAdvancedJsonPerFieldToJson.firstName(firstName as String?), + if (firstNameFieldValue != null) _$PrivateAdvancedJsonFieldMap['firstName']!: firstNameFieldValue, + if (lastName != _sentinel) _$PrivateAdvancedJsonFieldMap['lastName']!: _$PrivateAdvancedJsonPerFieldToJson.lastName(lastName as String?), + if (lastNameFieldValue != null) _$PrivateAdvancedJsonFieldMap['lastName']!: lastNameFieldValue, }; @@ -1547,11 +1588,14 @@ class _$_PrivateAdvancedJsonDocumentReference if (firstName != _sentinel) _$PrivateAdvancedJsonFieldMap['firstName']!: _$PrivateAdvancedJsonPerFieldToJson.firstName(firstName as String?), + if (firstNameFieldValue != null) _$PrivateAdvancedJsonFieldMap['firstName']!: firstNameFieldValue, + if (lastName != _sentinel) _$PrivateAdvancedJsonFieldMap['lastName']!: _$PrivateAdvancedJsonPerFieldToJson.lastName(lastName as String?), + if (lastNameFieldValue != null) _$PrivateAdvancedJsonFieldMap['lastName']!: lastNameFieldValue, }; @@ -1573,8 +1617,10 @@ class _$_PrivateAdvancedJsonDocumentReference abstract class _PrivateAdvancedJsonQuery implements - QueryReference<_PrivateAdvancedJson, - _PrivateAdvancedJsonQuerySnapshot> { + QueryReference< + _PrivateAdvancedJson, + _PrivateAdvancedJsonQuerySnapshot + > { @override _PrivateAdvancedJsonQuery limit(int limit); @@ -1719,25 +1765,28 @@ abstract class _PrivateAdvancedJsonQuery }); } -class _$_PrivateAdvancedJsonQuery extends QueryReference<_PrivateAdvancedJson, - _PrivateAdvancedJsonQuerySnapshot> implements _PrivateAdvancedJsonQuery { +class _$_PrivateAdvancedJsonQuery + extends + QueryReference<_PrivateAdvancedJson, _PrivateAdvancedJsonQuerySnapshot> + implements _PrivateAdvancedJsonQuery { _$_PrivateAdvancedJsonQuery( this._collection, { required Query<_PrivateAdvancedJson> $referenceWithoutCursor, $QueryCursor $queryCursor = const $QueryCursor(), }) : super( - $referenceWithoutCursor: $referenceWithoutCursor, - $queryCursor: $queryCursor, - ); + $referenceWithoutCursor: $referenceWithoutCursor, + $queryCursor: $queryCursor, + ); final CollectionReference _collection; @override - Stream<_PrivateAdvancedJsonQuerySnapshot> snapshots( - [SnapshotOptions? options]) { - return reference - .snapshots() - .map(_PrivateAdvancedJsonQuerySnapshot._fromQuerySnapshot); + Stream<_PrivateAdvancedJsonQuerySnapshot> snapshots([ + SnapshotOptions? options, + ]) { + return reference.snapshots().map( + _PrivateAdvancedJsonQuerySnapshot._fromQuerySnapshot, + ); } @override @@ -1794,7 +1843,8 @@ class _$_PrivateAdvancedJsonQuery extends QueryReference<_PrivateAdvancedJson, arrayContainsAny: arrayContainsAny, whereIn: whereIn, whereNotIn: whereNotIn, - isNull: isNull ?? + isNull: + isNull ?? (isEqualTo == null ? false : null) ?? (isNotEqualTo == null ? true : null), ), @@ -1826,7 +1876,8 @@ class _$_PrivateAdvancedJsonQuery extends QueryReference<_PrivateAdvancedJson, isGreaterThanOrEqualTo: isGreaterThanOrEqualTo, whereIn: whereIn, whereNotIn: whereNotIn, - isNull: isNull ?? + isNull: + isNull ?? (isEqualTo == null ? false : null) ?? (isNotEqualTo == null ? true : null), ), @@ -1851,34 +1902,43 @@ class _$_PrivateAdvancedJsonQuery extends QueryReference<_PrivateAdvancedJson, $referenceWithoutCursor: $referenceWithoutCursor.where( _$PrivateAdvancedJsonFieldMap['firstName']!, isEqualTo: isEqualTo != _sentinel - ? _$PrivateAdvancedJsonPerFieldToJson - .firstName(isEqualTo as String?) + ? _$PrivateAdvancedJsonPerFieldToJson.firstName( + isEqualTo as String?, + ) : null, isNotEqualTo: isNotEqualTo != _sentinel - ? _$PrivateAdvancedJsonPerFieldToJson - .firstName(isNotEqualTo as String?) + ? _$PrivateAdvancedJsonPerFieldToJson.firstName( + isNotEqualTo as String?, + ) : null, isLessThan: isLessThan != null - ? _$PrivateAdvancedJsonPerFieldToJson - .firstName(isLessThan as String?) + ? _$PrivateAdvancedJsonPerFieldToJson.firstName( + isLessThan as String?, + ) : null, isLessThanOrEqualTo: isLessThanOrEqualTo != null - ? _$PrivateAdvancedJsonPerFieldToJson - .firstName(isLessThanOrEqualTo as String?) + ? _$PrivateAdvancedJsonPerFieldToJson.firstName( + isLessThanOrEqualTo as String?, + ) : null, isGreaterThan: isGreaterThan != null - ? _$PrivateAdvancedJsonPerFieldToJson - .firstName(isGreaterThan as String?) + ? _$PrivateAdvancedJsonPerFieldToJson.firstName( + isGreaterThan as String?, + ) : null, isGreaterThanOrEqualTo: isGreaterThanOrEqualTo != null - ? _$PrivateAdvancedJsonPerFieldToJson - .firstName(isGreaterThanOrEqualTo as String?) + ? _$PrivateAdvancedJsonPerFieldToJson.firstName( + isGreaterThanOrEqualTo as String?, + ) : null, - whereIn: whereIn - ?.map((e) => _$PrivateAdvancedJsonPerFieldToJson.firstName(e)), - whereNotIn: whereNotIn - ?.map((e) => _$PrivateAdvancedJsonPerFieldToJson.firstName(e)), - isNull: isNull ?? + whereIn: whereIn?.map( + (e) => _$PrivateAdvancedJsonPerFieldToJson.firstName(e), + ), + whereNotIn: whereNotIn?.map( + (e) => _$PrivateAdvancedJsonPerFieldToJson.firstName(e), + ), + isNull: + isNull ?? (isEqualTo == null ? false : null) ?? (isNotEqualTo == null ? true : null), ), @@ -1906,30 +1966,38 @@ class _$_PrivateAdvancedJsonQuery extends QueryReference<_PrivateAdvancedJson, ? _$PrivateAdvancedJsonPerFieldToJson.lastName(isEqualTo as String?) : null, isNotEqualTo: isNotEqualTo != _sentinel - ? _$PrivateAdvancedJsonPerFieldToJson - .lastName(isNotEqualTo as String?) + ? _$PrivateAdvancedJsonPerFieldToJson.lastName( + isNotEqualTo as String?, + ) : null, isLessThan: isLessThan != null - ? _$PrivateAdvancedJsonPerFieldToJson - .lastName(isLessThan as String?) + ? _$PrivateAdvancedJsonPerFieldToJson.lastName( + isLessThan as String?, + ) : null, isLessThanOrEqualTo: isLessThanOrEqualTo != null - ? _$PrivateAdvancedJsonPerFieldToJson - .lastName(isLessThanOrEqualTo as String?) + ? _$PrivateAdvancedJsonPerFieldToJson.lastName( + isLessThanOrEqualTo as String?, + ) : null, isGreaterThan: isGreaterThan != null - ? _$PrivateAdvancedJsonPerFieldToJson - .lastName(isGreaterThan as String?) + ? _$PrivateAdvancedJsonPerFieldToJson.lastName( + isGreaterThan as String?, + ) : null, isGreaterThanOrEqualTo: isGreaterThanOrEqualTo != null - ? _$PrivateAdvancedJsonPerFieldToJson - .lastName(isGreaterThanOrEqualTo as String?) + ? _$PrivateAdvancedJsonPerFieldToJson.lastName( + isGreaterThanOrEqualTo as String?, + ) : null, - whereIn: whereIn - ?.map((e) => _$PrivateAdvancedJsonPerFieldToJson.lastName(e)), - whereNotIn: whereNotIn - ?.map((e) => _$PrivateAdvancedJsonPerFieldToJson.lastName(e)), - isNull: isNull ?? + whereIn: whereIn?.map( + (e) => _$PrivateAdvancedJsonPerFieldToJson.lastName(e), + ), + whereNotIn: whereNotIn?.map( + (e) => _$PrivateAdvancedJsonPerFieldToJson.lastName(e), + ), + isNull: + isNull ?? (isEqualTo == null ? false : null) ?? (isNotEqualTo == null ? true : null), ), @@ -1950,8 +2018,10 @@ class _$_PrivateAdvancedJsonQuery extends QueryReference<_PrivateAdvancedJson, _PrivateAdvancedJsonDocumentSnapshot? endBeforeDocument, _PrivateAdvancedJsonDocumentSnapshot? startAfterDocument, }) { - final query = - $referenceWithoutCursor.orderBy(fieldPath, descending: descending); + final query = $referenceWithoutCursor.orderBy( + fieldPath, + descending: descending, + ); var queryCursor = $queryCursor; if (startAtDocument != null) { @@ -2023,8 +2093,10 @@ class _$_PrivateAdvancedJsonQuery extends QueryReference<_PrivateAdvancedJson, _PrivateAdvancedJsonDocumentSnapshot? endBeforeDocument, _PrivateAdvancedJsonDocumentSnapshot? startAfterDocument, }) { - final query = $referenceWithoutCursor.orderBy(FieldPath.documentId, - descending: descending); + final query = $referenceWithoutCursor.orderBy( + FieldPath.documentId, + descending: descending, + ); var queryCursor = $queryCursor; if (startAtDocument != null) { @@ -2097,8 +2169,9 @@ class _$_PrivateAdvancedJsonQuery extends QueryReference<_PrivateAdvancedJson, _PrivateAdvancedJsonDocumentSnapshot? startAfterDocument, }) { final query = $referenceWithoutCursor.orderBy( - _$PrivateAdvancedJsonFieldMap['firstName']!, - descending: descending); + _$PrivateAdvancedJsonFieldMap['firstName']!, + descending: descending, + ); var queryCursor = $queryCursor; if (startAtDocument != null) { @@ -2130,7 +2203,7 @@ class _$_PrivateAdvancedJsonQuery extends QueryReference<_PrivateAdvancedJson, queryCursor = queryCursor.copyWith( startAt: [ ...queryCursor.startAt, - _$PrivateAdvancedJsonPerFieldToJson.firstName(startAt as String?) + _$PrivateAdvancedJsonPerFieldToJson.firstName(startAt as String?), ], startAtDocumentSnapshot: null, ); @@ -2139,7 +2212,7 @@ class _$_PrivateAdvancedJsonQuery extends QueryReference<_PrivateAdvancedJson, queryCursor = queryCursor.copyWith( startAfter: [ ...queryCursor.startAfter, - _$PrivateAdvancedJsonPerFieldToJson.firstName(startAfter as String?) + _$PrivateAdvancedJsonPerFieldToJson.firstName(startAfter as String?), ], startAfterDocumentSnapshot: null, ); @@ -2148,7 +2221,7 @@ class _$_PrivateAdvancedJsonQuery extends QueryReference<_PrivateAdvancedJson, queryCursor = queryCursor.copyWith( endAt: [ ...queryCursor.endAt, - _$PrivateAdvancedJsonPerFieldToJson.firstName(endAt as String?) + _$PrivateAdvancedJsonPerFieldToJson.firstName(endAt as String?), ], endAtDocumentSnapshot: null, ); @@ -2157,7 +2230,7 @@ class _$_PrivateAdvancedJsonQuery extends QueryReference<_PrivateAdvancedJson, queryCursor = queryCursor.copyWith( endBefore: [ ...queryCursor.endBefore, - _$PrivateAdvancedJsonPerFieldToJson.firstName(endBefore as String?) + _$PrivateAdvancedJsonPerFieldToJson.firstName(endBefore as String?), ], endBeforeDocumentSnapshot: null, ); @@ -2183,8 +2256,9 @@ class _$_PrivateAdvancedJsonQuery extends QueryReference<_PrivateAdvancedJson, _PrivateAdvancedJsonDocumentSnapshot? startAfterDocument, }) { final query = $referenceWithoutCursor.orderBy( - _$PrivateAdvancedJsonFieldMap['lastName']!, - descending: descending); + _$PrivateAdvancedJsonFieldMap['lastName']!, + descending: descending, + ); var queryCursor = $queryCursor; if (startAtDocument != null) { @@ -2216,7 +2290,7 @@ class _$_PrivateAdvancedJsonQuery extends QueryReference<_PrivateAdvancedJson, queryCursor = queryCursor.copyWith( startAt: [ ...queryCursor.startAt, - _$PrivateAdvancedJsonPerFieldToJson.lastName(startAt as String?) + _$PrivateAdvancedJsonPerFieldToJson.lastName(startAt as String?), ], startAtDocumentSnapshot: null, ); @@ -2225,7 +2299,7 @@ class _$_PrivateAdvancedJsonQuery extends QueryReference<_PrivateAdvancedJson, queryCursor = queryCursor.copyWith( startAfter: [ ...queryCursor.startAfter, - _$PrivateAdvancedJsonPerFieldToJson.lastName(startAfter as String?) + _$PrivateAdvancedJsonPerFieldToJson.lastName(startAfter as String?), ], startAfterDocumentSnapshot: null, ); @@ -2234,7 +2308,7 @@ class _$_PrivateAdvancedJsonQuery extends QueryReference<_PrivateAdvancedJson, queryCursor = queryCursor.copyWith( endAt: [ ...queryCursor.endAt, - _$PrivateAdvancedJsonPerFieldToJson.lastName(endAt as String?) + _$PrivateAdvancedJsonPerFieldToJson.lastName(endAt as String?), ], endAtDocumentSnapshot: null, ); @@ -2243,7 +2317,7 @@ class _$_PrivateAdvancedJsonQuery extends QueryReference<_PrivateAdvancedJson, queryCursor = queryCursor.copyWith( endBefore: [ ...queryCursor.endBefore, - _$PrivateAdvancedJsonPerFieldToJson.lastName(endBefore as String?) + _$PrivateAdvancedJsonPerFieldToJson.lastName(endBefore as String?), ], endBeforeDocumentSnapshot: null, ); @@ -2270,24 +2344,26 @@ class _$_PrivateAdvancedJsonQuery extends QueryReference<_PrivateAdvancedJson, class _PrivateAdvancedJsonDocumentSnapshot extends FirestoreDocumentSnapshot<_PrivateAdvancedJson> { _PrivateAdvancedJsonDocumentSnapshot._(this.snapshot) - : data = snapshot.data(); + : data = snapshot.data(); @override final DocumentSnapshot<_PrivateAdvancedJson> snapshot; @override _PrivateAdvancedJsonDocumentReference get reference { - return _PrivateAdvancedJsonDocumentReference( - snapshot.reference, - ); + return _PrivateAdvancedJsonDocumentReference(snapshot.reference); } @override final _PrivateAdvancedJson? data; } -class _PrivateAdvancedJsonQuerySnapshot extends FirestoreQuerySnapshot< - _PrivateAdvancedJson, _PrivateAdvancedJsonQueryDocumentSnapshot> { +class _PrivateAdvancedJsonQuerySnapshot + extends + FirestoreQuerySnapshot< + _PrivateAdvancedJson, + _PrivateAdvancedJsonQueryDocumentSnapshot + > { _PrivateAdvancedJsonQuerySnapshot._( this.snapshot, this.docs, @@ -2297,8 +2373,9 @@ class _PrivateAdvancedJsonQuerySnapshot extends FirestoreQuerySnapshot< factory _PrivateAdvancedJsonQuerySnapshot._fromQuerySnapshot( QuerySnapshot<_PrivateAdvancedJson> snapshot, ) { - final docs = - snapshot.docs.map(_PrivateAdvancedJsonQueryDocumentSnapshot._).toList(); + final docs = snapshot.docs + .map(_PrivateAdvancedJsonQueryDocumentSnapshot._) + .toList(); final docChanges = snapshot.docChanges.map((change) { return _decodeDocumentChange( @@ -2307,18 +2384,14 @@ class _PrivateAdvancedJsonQuerySnapshot extends FirestoreQuerySnapshot< ); }).toList(); - return _PrivateAdvancedJsonQuerySnapshot._( - snapshot, - docs, - docChanges, - ); + return _PrivateAdvancedJsonQuerySnapshot._(snapshot, docs, docChanges); } static FirestoreDocumentChange<_PrivateAdvancedJsonDocumentSnapshot> - _decodeDocumentChange( + _decodeDocumentChange( DocumentChange docChange, _PrivateAdvancedJsonDocumentSnapshot Function(DocumentSnapshot doc) - decodeDoc, + decodeDoc, ) { return FirestoreDocumentChange<_PrivateAdvancedJsonDocumentSnapshot>( type: docChange.type, @@ -2335,14 +2408,14 @@ class _PrivateAdvancedJsonQuerySnapshot extends FirestoreQuerySnapshot< @override final List> - docChanges; + docChanges; } class _PrivateAdvancedJsonQueryDocumentSnapshot extends FirestoreQueryDocumentSnapshot<_PrivateAdvancedJson> implements _PrivateAdvancedJsonDocumentSnapshot { _PrivateAdvancedJsonQueryDocumentSnapshot._(this.snapshot) - : data = snapshot.data(); + : data = snapshot.data(); @override final QueryDocumentSnapshot<_PrivateAdvancedJson> snapshot; @@ -2363,9 +2436,8 @@ abstract class EmptyModelCollectionReference implements EmptyModelQuery, FirestoreCollectionReference { - factory EmptyModelCollectionReference([ - FirebaseFirestore? firestore, - ]) = _$EmptyModelCollectionReference; + factory EmptyModelCollectionReference([FirebaseFirestore? firestore]) = + _$EmptyModelCollectionReference; static EmptyModel fromFirestore( DocumentSnapshot> snapshot, @@ -2398,16 +2470,17 @@ class _$EmptyModelCollectionReference extends _$EmptyModelQuery firestore ??= FirebaseFirestore.instance; return _$EmptyModelCollectionReference._( - firestore.collection('firestore-example-app/test/config').withConverter( + firestore + .collection('firestore-example-app/test/config') + .withConverter( fromFirestore: EmptyModelCollectionReference.fromFirestore, toFirestore: EmptyModelCollectionReference.toFirestore, ), ); } - _$EmptyModelCollectionReference._( - CollectionReference reference, - ) : super(reference, $referenceWithoutCursor: reference); + _$EmptyModelCollectionReference._(CollectionReference reference) + : super(reference, $referenceWithoutCursor: reference); String get path => reference.path; @@ -2421,9 +2494,7 @@ class _$EmptyModelCollectionReference extends _$EmptyModelQuery id == null || id.split('/').length == 1, 'The document ID cannot be from a different collection', ); - return EmptyModelDocumentReference( - reference.doc(id), - ); + return EmptyModelDocumentReference(reference.doc(id)); } @override @@ -2610,17 +2681,17 @@ class _$EmptyModelQuery required Query $referenceWithoutCursor, $QueryCursor $queryCursor = const $QueryCursor(), }) : super( - $referenceWithoutCursor: $referenceWithoutCursor, - $queryCursor: $queryCursor, - ); + $referenceWithoutCursor: $referenceWithoutCursor, + $queryCursor: $queryCursor, + ); final CollectionReference _collection; @override Stream snapshots([SnapshotOptions? options]) { - return reference - .snapshots() - .map(EmptyModelQuerySnapshot._fromQuerySnapshot); + return reference.snapshots().map( + EmptyModelQuerySnapshot._fromQuerySnapshot, + ); } @override @@ -2677,7 +2748,8 @@ class _$EmptyModelQuery arrayContainsAny: arrayContainsAny, whereIn: whereIn, whereNotIn: whereNotIn, - isNull: isNull ?? + isNull: + isNull ?? (isEqualTo == null ? false : null) ?? (isNotEqualTo == null ? true : null), ), @@ -2709,7 +2781,8 @@ class _$EmptyModelQuery isGreaterThanOrEqualTo: isGreaterThanOrEqualTo, whereIn: whereIn, whereNotIn: whereNotIn, - isNull: isNull ?? + isNull: + isNull ?? (isEqualTo == null ? false : null) ?? (isNotEqualTo == null ? true : null), ), @@ -2730,8 +2803,10 @@ class _$EmptyModelQuery EmptyModelDocumentSnapshot? endBeforeDocument, EmptyModelDocumentSnapshot? startAfterDocument, }) { - final query = - $referenceWithoutCursor.orderBy(fieldPath, descending: descending); + final query = $referenceWithoutCursor.orderBy( + fieldPath, + descending: descending, + ); var queryCursor = $queryCursor; if (startAtDocument != null) { @@ -2803,8 +2878,10 @@ class _$EmptyModelQuery EmptyModelDocumentSnapshot? endBeforeDocument, EmptyModelDocumentSnapshot? startAfterDocument, }) { - final query = $referenceWithoutCursor.orderBy(FieldPath.documentId, - descending: descending); + final query = $referenceWithoutCursor.orderBy( + FieldPath.documentId, + descending: descending, + ); var queryCursor = $queryCursor; if (startAtDocument != null) { @@ -2883,22 +2960,17 @@ class EmptyModelDocumentSnapshot extends FirestoreDocumentSnapshot { @override EmptyModelDocumentReference get reference { - return EmptyModelDocumentReference( - snapshot.reference, - ); + return EmptyModelDocumentReference(snapshot.reference); } @override final EmptyModel? data; } -class EmptyModelQuerySnapshot extends FirestoreQuerySnapshot { - EmptyModelQuerySnapshot._( - this.snapshot, - this.docs, - this.docChanges, - ); +class EmptyModelQuerySnapshot + extends + FirestoreQuerySnapshot { + EmptyModelQuerySnapshot._(this.snapshot, this.docs, this.docChanges); factory EmptyModelQuerySnapshot._fromQuerySnapshot( QuerySnapshot snapshot, @@ -2906,21 +2978,14 @@ class EmptyModelQuerySnapshot extends FirestoreQuerySnapshot - _decodeDocumentChange( + _decodeDocumentChange( DocumentChange docChange, EmptyModelDocumentSnapshot Function(DocumentSnapshot doc) decodeDoc, ) { @@ -2973,9 +3038,9 @@ Map _$EmptyModelToJson(EmptyModel instance) => {}; AdvancedJson _$AdvancedJsonFromJson(Map json) => AdvancedJson( - firstName: json['first_name'] as String?, - lastName: json['LAST_NAME'] as String?, - ); + firstName: json['first_name'] as String?, + lastName: json['LAST_NAME'] as String?, +); const _$AdvancedJsonFieldMap = { 'firstName': 'first_name', @@ -3016,8 +3081,8 @@ abstract class _$PrivateAdvancedJsonPerFieldToJson { } Map _$PrivateAdvancedJsonToJson( - _PrivateAdvancedJson instance) => - { - 'first_name': instance.firstName, - 'LAST_NAME': instance.lastName, - }; + _PrivateAdvancedJson instance, +) => { + 'first_name': instance.firstName, + 'LAST_NAME': instance.lastName, +}; diff --git a/packages/cloud_firestore_odm/example/lib/integration/enums.g.dart b/packages/cloud_firestore_odm/example/lib/integration/enums.g.dart index 20a9ff6..8b303b5 100644 --- a/packages/cloud_firestore_odm/example/lib/integration/enums.g.dart +++ b/packages/cloud_firestore_odm/example/lib/integration/enums.g.dart @@ -26,9 +26,8 @@ abstract class EnumsCollectionReference implements EnumsQuery, FirestoreCollectionReference { - factory EnumsCollectionReference([ - FirebaseFirestore? firestore, - ]) = _$EnumsCollectionReference; + factory EnumsCollectionReference([FirebaseFirestore? firestore]) = + _$EnumsCollectionReference; static Enums fromFirestore( DocumentSnapshot> snapshot, @@ -37,10 +36,7 @@ abstract class EnumsCollectionReference return Enums.fromJson(snapshot.data()!); } - static Map toFirestore( - Enums value, - SetOptions? options, - ) { + static Map toFirestore(Enums value, SetOptions? options) { return value.toJson(); } @@ -61,16 +57,17 @@ class _$EnumsCollectionReference extends _$EnumsQuery firestore ??= FirebaseFirestore.instance; return _$EnumsCollectionReference._( - firestore.collection('firestore-example-app').withConverter( + firestore + .collection('firestore-example-app') + .withConverter( fromFirestore: EnumsCollectionReference.fromFirestore, toFirestore: EnumsCollectionReference.toFirestore, ), ); } - _$EnumsCollectionReference._( - CollectionReference reference, - ) : super(reference, $referenceWithoutCursor: reference); + _$EnumsCollectionReference._(CollectionReference reference) + : super(reference, $referenceWithoutCursor: reference); String get path => reference.path; @@ -84,9 +81,7 @@ class _$EnumsCollectionReference extends _$EnumsQuery id == null || id.split('/').length == 1, 'The document ID cannot be from a different collection', ); - return EnumsDocumentReference( - reference.doc(id), - ); + return EnumsDocumentReference(reference.doc(id)); } @override @@ -272,12 +267,16 @@ class _$EnumsDocumentReference final json = { ...model.toJson(), if (idFieldValue != null) _$EnumsFieldMap['id']!: idFieldValue, + if (enumValueFieldValue != null) _$EnumsFieldMap['enumValue']!: enumValueFieldValue, + if (nullableEnumValueFieldValue != null) _$EnumsFieldMap['nullableEnumValue']!: nullableEnumValueFieldValue, + if (enumListFieldValue != null) _$EnumsFieldMap['enumList']!: enumListFieldValue, + if (nullableEnumListFieldValue != null) _$EnumsFieldMap['nullableEnumList']!: nullableEnumListFieldValue, }; @@ -302,12 +301,16 @@ class _$EnumsDocumentReference final json = { ...model.toJson(), if (idFieldValue != null) _$EnumsFieldMap['id']!: idFieldValue, + if (enumValueFieldValue != null) _$EnumsFieldMap['enumValue']!: enumValueFieldValue, + if (nullableEnumValueFieldValue != null) _$EnumsFieldMap['nullableEnumValue']!: nullableEnumValueFieldValue, + if (enumListFieldValue != null) _$EnumsFieldMap['enumList']!: enumListFieldValue, + if (nullableEnumListFieldValue != null) _$EnumsFieldMap['nullableEnumList']!: nullableEnumListFieldValue, }; @@ -332,12 +335,16 @@ class _$EnumsDocumentReference final json = { ...model.toJson(), if (idFieldValue != null) _$EnumsFieldMap['id']!: idFieldValue, + if (enumValueFieldValue != null) _$EnumsFieldMap['enumValue']!: enumValueFieldValue, + if (nullableEnumValueFieldValue != null) _$EnumsFieldMap['nullableEnumValue']!: nullableEnumValueFieldValue, + if (enumListFieldValue != null) _$EnumsFieldMap['enumList']!: enumListFieldValue, + if (nullableEnumListFieldValue != null) _$EnumsFieldMap['nullableEnumList']!: nullableEnumListFieldValue, }; @@ -384,25 +391,36 @@ class _$EnumsDocumentReference final json = { if (id != _sentinel) _$EnumsFieldMap['id']!: _$EnumsPerFieldToJson.id(id as String), + if (idFieldValue != null) _$EnumsFieldMap['id']!: idFieldValue, + if (enumValue != _sentinel) - _$EnumsFieldMap['enumValue']!: - _$EnumsPerFieldToJson.enumValue(enumValue as TestEnum), + _$EnumsFieldMap['enumValue']!: _$EnumsPerFieldToJson.enumValue( + enumValue as TestEnum, + ), + if (enumValueFieldValue != null) _$EnumsFieldMap['enumValue']!: enumValueFieldValue, + if (nullableEnumValue != _sentinel) _$EnumsFieldMap['nullableEnumValue']!: _$EnumsPerFieldToJson .nullableEnumValue(nullableEnumValue as TestEnum?), + if (nullableEnumValueFieldValue != null) _$EnumsFieldMap['nullableEnumValue']!: nullableEnumValueFieldValue, + if (enumList != _sentinel) - _$EnumsFieldMap['enumList']!: - _$EnumsPerFieldToJson.enumList(enumList as List), + _$EnumsFieldMap['enumList']!: _$EnumsPerFieldToJson.enumList( + enumList as List, + ), + if (enumListFieldValue != null) _$EnumsFieldMap['enumList']!: enumListFieldValue, + if (nullableEnumList != _sentinel) _$EnumsFieldMap['nullableEnumList']!: _$EnumsPerFieldToJson .nullableEnumList(nullableEnumList as List?), + if (nullableEnumListFieldValue != null) _$EnumsFieldMap['nullableEnumList']!: nullableEnumListFieldValue, }; @@ -446,25 +464,36 @@ class _$EnumsDocumentReference final json = { if (id != _sentinel) _$EnumsFieldMap['id']!: _$EnumsPerFieldToJson.id(id as String), + if (idFieldValue != null) _$EnumsFieldMap['id']!: idFieldValue, + if (enumValue != _sentinel) - _$EnumsFieldMap['enumValue']!: - _$EnumsPerFieldToJson.enumValue(enumValue as TestEnum), + _$EnumsFieldMap['enumValue']!: _$EnumsPerFieldToJson.enumValue( + enumValue as TestEnum, + ), + if (enumValueFieldValue != null) _$EnumsFieldMap['enumValue']!: enumValueFieldValue, + if (nullableEnumValue != _sentinel) _$EnumsFieldMap['nullableEnumValue']!: _$EnumsPerFieldToJson .nullableEnumValue(nullableEnumValue as TestEnum?), + if (nullableEnumValueFieldValue != null) _$EnumsFieldMap['nullableEnumValue']!: nullableEnumValueFieldValue, + if (enumList != _sentinel) - _$EnumsFieldMap['enumList']!: - _$EnumsPerFieldToJson.enumList(enumList as List), + _$EnumsFieldMap['enumList']!: _$EnumsPerFieldToJson.enumList( + enumList as List, + ), + if (enumListFieldValue != null) _$EnumsFieldMap['enumList']!: enumListFieldValue, + if (nullableEnumList != _sentinel) _$EnumsFieldMap['nullableEnumList']!: _$EnumsPerFieldToJson .nullableEnumList(nullableEnumList as List?), + if (nullableEnumListFieldValue != null) _$EnumsFieldMap['nullableEnumList']!: nullableEnumListFieldValue, }; @@ -508,25 +537,36 @@ class _$EnumsDocumentReference final json = { if (id != _sentinel) _$EnumsFieldMap['id']!: _$EnumsPerFieldToJson.id(id as String), + if (idFieldValue != null) _$EnumsFieldMap['id']!: idFieldValue, + if (enumValue != _sentinel) - _$EnumsFieldMap['enumValue']!: - _$EnumsPerFieldToJson.enumValue(enumValue as TestEnum), + _$EnumsFieldMap['enumValue']!: _$EnumsPerFieldToJson.enumValue( + enumValue as TestEnum, + ), + if (enumValueFieldValue != null) _$EnumsFieldMap['enumValue']!: enumValueFieldValue, + if (nullableEnumValue != _sentinel) _$EnumsFieldMap['nullableEnumValue']!: _$EnumsPerFieldToJson .nullableEnumValue(nullableEnumValue as TestEnum?), + if (nullableEnumValueFieldValue != null) _$EnumsFieldMap['nullableEnumValue']!: nullableEnumValueFieldValue, + if (enumList != _sentinel) - _$EnumsFieldMap['enumList']!: - _$EnumsPerFieldToJson.enumList(enumList as List), + _$EnumsFieldMap['enumList']!: _$EnumsPerFieldToJson.enumList( + enumList as List, + ), + if (enumListFieldValue != null) _$EnumsFieldMap['enumList']!: enumListFieldValue, + if (nullableEnumList != _sentinel) _$EnumsFieldMap['nullableEnumList']!: _$EnumsPerFieldToJson .nullableEnumList(nullableEnumList as List?), + if (nullableEnumListFieldValue != null) _$EnumsFieldMap['nullableEnumList']!: nullableEnumListFieldValue, }; @@ -770,9 +810,9 @@ class _$EnumsQuery extends QueryReference required Query $referenceWithoutCursor, $QueryCursor $queryCursor = const $QueryCursor(), }) : super( - $referenceWithoutCursor: $referenceWithoutCursor, - $queryCursor: $queryCursor, - ); + $referenceWithoutCursor: $referenceWithoutCursor, + $queryCursor: $queryCursor, + ); final CollectionReference _collection; @@ -833,7 +873,8 @@ class _$EnumsQuery extends QueryReference arrayContainsAny: arrayContainsAny, whereIn: whereIn, whereNotIn: whereNotIn, - isNull: isNull ?? + isNull: + isNull ?? (isEqualTo == null ? false : null) ?? (isNotEqualTo == null ? true : null), ), @@ -865,7 +906,8 @@ class _$EnumsQuery extends QueryReference isGreaterThanOrEqualTo: isGreaterThanOrEqualTo, whereIn: whereIn, whereNotIn: whereNotIn, - isNull: isNull ?? + isNull: + isNull ?? (isEqualTo == null ? false : null) ?? (isNotEqualTo == null ? true : null), ), @@ -909,7 +951,8 @@ class _$EnumsQuery extends QueryReference : null, whereIn: whereIn?.map((e) => _$EnumsPerFieldToJson.id(e)), whereNotIn: whereNotIn?.map((e) => _$EnumsPerFieldToJson.id(e)), - isNull: isNull ?? + isNull: + isNull ?? (isEqualTo == null ? false : null) ?? (isNotEqualTo == null ? true : null), ), @@ -949,12 +992,14 @@ class _$EnumsQuery extends QueryReference ? _$EnumsPerFieldToJson.enumValue(isGreaterThan as TestEnum) : null, isGreaterThanOrEqualTo: isGreaterThanOrEqualTo != null - ? _$EnumsPerFieldToJson - .enumValue(isGreaterThanOrEqualTo as TestEnum) + ? _$EnumsPerFieldToJson.enumValue( + isGreaterThanOrEqualTo as TestEnum, + ) : null, whereIn: whereIn?.map((e) => _$EnumsPerFieldToJson.enumValue(e)), whereNotIn: whereNotIn?.map((e) => _$EnumsPerFieldToJson.enumValue(e)), - isNull: isNull ?? + isNull: + isNull ?? (isEqualTo == null ? false : null) ?? (isNotEqualTo == null ? true : null), ), @@ -988,22 +1033,28 @@ class _$EnumsQuery extends QueryReference ? _$EnumsPerFieldToJson.nullableEnumValue(isLessThan as TestEnum?) : null, isLessThanOrEqualTo: isLessThanOrEqualTo != null - ? _$EnumsPerFieldToJson - .nullableEnumValue(isLessThanOrEqualTo as TestEnum?) + ? _$EnumsPerFieldToJson.nullableEnumValue( + isLessThanOrEqualTo as TestEnum?, + ) : null, isGreaterThan: isGreaterThan != null - ? _$EnumsPerFieldToJson - .nullableEnumValue(isGreaterThan as TestEnum?) + ? _$EnumsPerFieldToJson.nullableEnumValue( + isGreaterThan as TestEnum?, + ) : null, isGreaterThanOrEqualTo: isGreaterThanOrEqualTo != null - ? _$EnumsPerFieldToJson - .nullableEnumValue(isGreaterThanOrEqualTo as TestEnum?) + ? _$EnumsPerFieldToJson.nullableEnumValue( + isGreaterThanOrEqualTo as TestEnum?, + ) : null, - whereIn: - whereIn?.map((e) => _$EnumsPerFieldToJson.nullableEnumValue(e)), - whereNotIn: - whereNotIn?.map((e) => _$EnumsPerFieldToJson.nullableEnumValue(e)), - isNull: isNull ?? + whereIn: whereIn?.map( + (e) => _$EnumsPerFieldToJson.nullableEnumValue(e), + ), + whereNotIn: whereNotIn?.map( + (e) => _$EnumsPerFieldToJson.nullableEnumValue(e), + ), + isNull: + isNull ?? (isEqualTo == null ? false : null) ?? (isNotEqualTo == null ? true : null), ), @@ -1037,26 +1088,29 @@ class _$EnumsQuery extends QueryReference ? _$EnumsPerFieldToJson.enumList(isLessThan as List) : null, isLessThanOrEqualTo: isLessThanOrEqualTo != null - ? _$EnumsPerFieldToJson - .enumList(isLessThanOrEqualTo as List) + ? _$EnumsPerFieldToJson.enumList( + isLessThanOrEqualTo as List, + ) : null, isGreaterThan: isGreaterThan != null ? _$EnumsPerFieldToJson.enumList(isGreaterThan as List) : null, isGreaterThanOrEqualTo: isGreaterThanOrEqualTo != null - ? _$EnumsPerFieldToJson - .enumList(isGreaterThanOrEqualTo as List) + ? _$EnumsPerFieldToJson.enumList( + isGreaterThanOrEqualTo as List, + ) : null, arrayContains: arrayContains != null ? (_$EnumsPerFieldToJson.enumList([arrayContains as TestEnum]) - as List?)! - .single + as List?)! + .single : null, arrayContainsAny: arrayContainsAny != null ? _$EnumsPerFieldToJson.enumList(arrayContainsAny) - as Iterable? + as Iterable? : null, - isNull: isNull ?? + isNull: + isNull ?? (isEqualTo == null ? false : null) ?? (isNotEqualTo == null ? true : null), ), @@ -1081,39 +1135,48 @@ class _$EnumsQuery extends QueryReference $referenceWithoutCursor: $referenceWithoutCursor.where( _$EnumsFieldMap['nullableEnumList']!, isEqualTo: isEqualTo != _sentinel - ? _$EnumsPerFieldToJson - .nullableEnumList(isEqualTo as List?) + ? _$EnumsPerFieldToJson.nullableEnumList( + isEqualTo as List?, + ) : null, isNotEqualTo: isNotEqualTo != _sentinel - ? _$EnumsPerFieldToJson - .nullableEnumList(isNotEqualTo as List?) + ? _$EnumsPerFieldToJson.nullableEnumList( + isNotEqualTo as List?, + ) : null, isLessThan: isLessThan != null - ? _$EnumsPerFieldToJson - .nullableEnumList(isLessThan as List?) + ? _$EnumsPerFieldToJson.nullableEnumList( + isLessThan as List?, + ) : null, isLessThanOrEqualTo: isLessThanOrEqualTo != null - ? _$EnumsPerFieldToJson - .nullableEnumList(isLessThanOrEqualTo as List?) + ? _$EnumsPerFieldToJson.nullableEnumList( + isLessThanOrEqualTo as List?, + ) : null, isGreaterThan: isGreaterThan != null - ? _$EnumsPerFieldToJson - .nullableEnumList(isGreaterThan as List?) + ? _$EnumsPerFieldToJson.nullableEnumList( + isGreaterThan as List?, + ) : null, isGreaterThanOrEqualTo: isGreaterThanOrEqualTo != null - ? _$EnumsPerFieldToJson - .nullableEnumList(isGreaterThanOrEqualTo as List?) + ? _$EnumsPerFieldToJson.nullableEnumList( + isGreaterThanOrEqualTo as List?, + ) : null, arrayContains: arrayContains != null - ? (_$EnumsPerFieldToJson - .nullableEnumList([arrayContains as TestEnum]) as List?)! - .single + ? (_$EnumsPerFieldToJson.nullableEnumList([ + arrayContains as TestEnum, + ]) + as List?)! + .single : null, arrayContainsAny: arrayContainsAny != null ? _$EnumsPerFieldToJson.nullableEnumList(arrayContainsAny) - as Iterable? + as Iterable? : null, - isNull: isNull ?? + isNull: + isNull ?? (isEqualTo == null ? false : null) ?? (isNotEqualTo == null ? true : null), ), @@ -1134,8 +1197,10 @@ class _$EnumsQuery extends QueryReference EnumsDocumentSnapshot? endBeforeDocument, EnumsDocumentSnapshot? startAfterDocument, }) { - final query = - $referenceWithoutCursor.orderBy(fieldPath, descending: descending); + final query = $referenceWithoutCursor.orderBy( + fieldPath, + descending: descending, + ); var queryCursor = $queryCursor; if (startAtDocument != null) { @@ -1207,8 +1272,10 @@ class _$EnumsQuery extends QueryReference EnumsDocumentSnapshot? endBeforeDocument, EnumsDocumentSnapshot? startAfterDocument, }) { - final query = $referenceWithoutCursor.orderBy(FieldPath.documentId, - descending: descending); + final query = $referenceWithoutCursor.orderBy( + FieldPath.documentId, + descending: descending, + ); var queryCursor = $queryCursor; if (startAtDocument != null) { @@ -1280,8 +1347,10 @@ class _$EnumsQuery extends QueryReference EnumsDocumentSnapshot? endBeforeDocument, EnumsDocumentSnapshot? startAfterDocument, }) { - final query = $referenceWithoutCursor.orderBy(_$EnumsFieldMap['id']!, - descending: descending); + final query = $referenceWithoutCursor.orderBy( + _$EnumsFieldMap['id']!, + descending: descending, + ); var queryCursor = $queryCursor; if (startAtDocument != null) { @@ -1313,7 +1382,7 @@ class _$EnumsQuery extends QueryReference queryCursor = queryCursor.copyWith( startAt: [ ...queryCursor.startAt, - _$EnumsPerFieldToJson.id(startAt as String) + _$EnumsPerFieldToJson.id(startAt as String), ], startAtDocumentSnapshot: null, ); @@ -1322,7 +1391,7 @@ class _$EnumsQuery extends QueryReference queryCursor = queryCursor.copyWith( startAfter: [ ...queryCursor.startAfter, - _$EnumsPerFieldToJson.id(startAfter as String) + _$EnumsPerFieldToJson.id(startAfter as String), ], startAfterDocumentSnapshot: null, ); @@ -1331,7 +1400,7 @@ class _$EnumsQuery extends QueryReference queryCursor = queryCursor.copyWith( endAt: [ ...queryCursor.endAt, - _$EnumsPerFieldToJson.id(endAt as String) + _$EnumsPerFieldToJson.id(endAt as String), ], endAtDocumentSnapshot: null, ); @@ -1340,7 +1409,7 @@ class _$EnumsQuery extends QueryReference queryCursor = queryCursor.copyWith( endBefore: [ ...queryCursor.endBefore, - _$EnumsPerFieldToJson.id(endBefore as String) + _$EnumsPerFieldToJson.id(endBefore as String), ], endBeforeDocumentSnapshot: null, ); @@ -1365,8 +1434,10 @@ class _$EnumsQuery extends QueryReference EnumsDocumentSnapshot? endBeforeDocument, EnumsDocumentSnapshot? startAfterDocument, }) { - final query = $referenceWithoutCursor.orderBy(_$EnumsFieldMap['enumValue']!, - descending: descending); + final query = $referenceWithoutCursor.orderBy( + _$EnumsFieldMap['enumValue']!, + descending: descending, + ); var queryCursor = $queryCursor; if (startAtDocument != null) { @@ -1398,7 +1469,7 @@ class _$EnumsQuery extends QueryReference queryCursor = queryCursor.copyWith( startAt: [ ...queryCursor.startAt, - _$EnumsPerFieldToJson.enumValue(startAt as TestEnum) + _$EnumsPerFieldToJson.enumValue(startAt as TestEnum), ], startAtDocumentSnapshot: null, ); @@ -1407,7 +1478,7 @@ class _$EnumsQuery extends QueryReference queryCursor = queryCursor.copyWith( startAfter: [ ...queryCursor.startAfter, - _$EnumsPerFieldToJson.enumValue(startAfter as TestEnum) + _$EnumsPerFieldToJson.enumValue(startAfter as TestEnum), ], startAfterDocumentSnapshot: null, ); @@ -1416,7 +1487,7 @@ class _$EnumsQuery extends QueryReference queryCursor = queryCursor.copyWith( endAt: [ ...queryCursor.endAt, - _$EnumsPerFieldToJson.enumValue(endAt as TestEnum) + _$EnumsPerFieldToJson.enumValue(endAt as TestEnum), ], endAtDocumentSnapshot: null, ); @@ -1425,7 +1496,7 @@ class _$EnumsQuery extends QueryReference queryCursor = queryCursor.copyWith( endBefore: [ ...queryCursor.endBefore, - _$EnumsPerFieldToJson.enumValue(endBefore as TestEnum) + _$EnumsPerFieldToJson.enumValue(endBefore as TestEnum), ], endBeforeDocumentSnapshot: null, ); @@ -1450,8 +1521,10 @@ class _$EnumsQuery extends QueryReference EnumsDocumentSnapshot? endBeforeDocument, EnumsDocumentSnapshot? startAfterDocument, }) { - final query = $referenceWithoutCursor - .orderBy(_$EnumsFieldMap['nullableEnumValue']!, descending: descending); + final query = $referenceWithoutCursor.orderBy( + _$EnumsFieldMap['nullableEnumValue']!, + descending: descending, + ); var queryCursor = $queryCursor; if (startAtDocument != null) { @@ -1483,7 +1556,7 @@ class _$EnumsQuery extends QueryReference queryCursor = queryCursor.copyWith( startAt: [ ...queryCursor.startAt, - _$EnumsPerFieldToJson.nullableEnumValue(startAt as TestEnum?) + _$EnumsPerFieldToJson.nullableEnumValue(startAt as TestEnum?), ], startAtDocumentSnapshot: null, ); @@ -1492,7 +1565,7 @@ class _$EnumsQuery extends QueryReference queryCursor = queryCursor.copyWith( startAfter: [ ...queryCursor.startAfter, - _$EnumsPerFieldToJson.nullableEnumValue(startAfter as TestEnum?) + _$EnumsPerFieldToJson.nullableEnumValue(startAfter as TestEnum?), ], startAfterDocumentSnapshot: null, ); @@ -1501,7 +1574,7 @@ class _$EnumsQuery extends QueryReference queryCursor = queryCursor.copyWith( endAt: [ ...queryCursor.endAt, - _$EnumsPerFieldToJson.nullableEnumValue(endAt as TestEnum?) + _$EnumsPerFieldToJson.nullableEnumValue(endAt as TestEnum?), ], endAtDocumentSnapshot: null, ); @@ -1510,7 +1583,7 @@ class _$EnumsQuery extends QueryReference queryCursor = queryCursor.copyWith( endBefore: [ ...queryCursor.endBefore, - _$EnumsPerFieldToJson.nullableEnumValue(endBefore as TestEnum?) + _$EnumsPerFieldToJson.nullableEnumValue(endBefore as TestEnum?), ], endBeforeDocumentSnapshot: null, ); @@ -1535,8 +1608,10 @@ class _$EnumsQuery extends QueryReference EnumsDocumentSnapshot? endBeforeDocument, EnumsDocumentSnapshot? startAfterDocument, }) { - final query = $referenceWithoutCursor.orderBy(_$EnumsFieldMap['enumList']!, - descending: descending); + final query = $referenceWithoutCursor.orderBy( + _$EnumsFieldMap['enumList']!, + descending: descending, + ); var queryCursor = $queryCursor; if (startAtDocument != null) { @@ -1568,7 +1643,7 @@ class _$EnumsQuery extends QueryReference queryCursor = queryCursor.copyWith( startAt: [ ...queryCursor.startAt, - _$EnumsPerFieldToJson.enumList(startAt as List) + _$EnumsPerFieldToJson.enumList(startAt as List), ], startAtDocumentSnapshot: null, ); @@ -1577,7 +1652,7 @@ class _$EnumsQuery extends QueryReference queryCursor = queryCursor.copyWith( startAfter: [ ...queryCursor.startAfter, - _$EnumsPerFieldToJson.enumList(startAfter as List) + _$EnumsPerFieldToJson.enumList(startAfter as List), ], startAfterDocumentSnapshot: null, ); @@ -1586,7 +1661,7 @@ class _$EnumsQuery extends QueryReference queryCursor = queryCursor.copyWith( endAt: [ ...queryCursor.endAt, - _$EnumsPerFieldToJson.enumList(endAt as List) + _$EnumsPerFieldToJson.enumList(endAt as List), ], endAtDocumentSnapshot: null, ); @@ -1595,7 +1670,7 @@ class _$EnumsQuery extends QueryReference queryCursor = queryCursor.copyWith( endBefore: [ ...queryCursor.endBefore, - _$EnumsPerFieldToJson.enumList(endBefore as List) + _$EnumsPerFieldToJson.enumList(endBefore as List), ], endBeforeDocumentSnapshot: null, ); @@ -1620,8 +1695,10 @@ class _$EnumsQuery extends QueryReference EnumsDocumentSnapshot? endBeforeDocument, EnumsDocumentSnapshot? startAfterDocument, }) { - final query = $referenceWithoutCursor - .orderBy(_$EnumsFieldMap['nullableEnumList']!, descending: descending); + final query = $referenceWithoutCursor.orderBy( + _$EnumsFieldMap['nullableEnumList']!, + descending: descending, + ); var queryCursor = $queryCursor; if (startAtDocument != null) { @@ -1653,7 +1730,7 @@ class _$EnumsQuery extends QueryReference queryCursor = queryCursor.copyWith( startAt: [ ...queryCursor.startAt, - _$EnumsPerFieldToJson.nullableEnumList(startAt as List?) + _$EnumsPerFieldToJson.nullableEnumList(startAt as List?), ], startAtDocumentSnapshot: null, ); @@ -1662,7 +1739,7 @@ class _$EnumsQuery extends QueryReference queryCursor = queryCursor.copyWith( startAfter: [ ...queryCursor.startAfter, - _$EnumsPerFieldToJson.nullableEnumList(startAfter as List?) + _$EnumsPerFieldToJson.nullableEnumList(startAfter as List?), ], startAfterDocumentSnapshot: null, ); @@ -1671,7 +1748,7 @@ class _$EnumsQuery extends QueryReference queryCursor = queryCursor.copyWith( endAt: [ ...queryCursor.endAt, - _$EnumsPerFieldToJson.nullableEnumList(endAt as List?) + _$EnumsPerFieldToJson.nullableEnumList(endAt as List?), ], endAtDocumentSnapshot: null, ); @@ -1680,7 +1757,7 @@ class _$EnumsQuery extends QueryReference queryCursor = queryCursor.copyWith( endBefore: [ ...queryCursor.endBefore, - _$EnumsPerFieldToJson.nullableEnumList(endBefore as List?) + _$EnumsPerFieldToJson.nullableEnumList(endBefore as List?), ], endBeforeDocumentSnapshot: null, ); @@ -1712,9 +1789,7 @@ class EnumsDocumentSnapshot extends FirestoreDocumentSnapshot { @override EnumsDocumentReference get reference { - return EnumsDocumentReference( - snapshot.reference, - ); + return EnumsDocumentReference(snapshot.reference); } @override @@ -1723,33 +1798,20 @@ class EnumsDocumentSnapshot extends FirestoreDocumentSnapshot { class EnumsQuerySnapshot extends FirestoreQuerySnapshot { - EnumsQuerySnapshot._( - this.snapshot, - this.docs, - this.docChanges, - ); - - factory EnumsQuerySnapshot._fromQuerySnapshot( - QuerySnapshot snapshot, - ) { + EnumsQuerySnapshot._(this.snapshot, this.docs, this.docChanges); + + factory EnumsQuerySnapshot._fromQuerySnapshot(QuerySnapshot snapshot) { final docs = snapshot.docs.map(EnumsQueryDocumentSnapshot._).toList(); final docChanges = snapshot.docChanges.map((change) { - return _decodeDocumentChange( - change, - EnumsDocumentSnapshot._, - ); + return _decodeDocumentChange(change, EnumsDocumentSnapshot._); }).toList(); - return EnumsQuerySnapshot._( - snapshot, - docs, - docChanges, - ); + return EnumsQuerySnapshot._(snapshot, docs, docChanges); } static FirestoreDocumentChange - _decodeDocumentChange( + _decodeDocumentChange( DocumentChange docChange, EnumsDocumentSnapshot Function(DocumentSnapshot doc) decodeDoc, ) { @@ -1791,19 +1853,22 @@ class EnumsQueryDocumentSnapshot extends FirestoreQueryDocumentSnapshot // ************************************************************************** Enums _$EnumsFromJson(Map json) => Enums( - id: json['id'] as String, - enumValue: $enumDecodeNullable(_$TestEnumEnumMap, json['enumValue']) ?? - TestEnum.one, - nullableEnumValue: - $enumDecodeNullable(_$TestEnumEnumMap, json['nullableEnumValue']), - enumList: (json['enumList'] as List?) - ?.map((e) => $enumDecode(_$TestEnumEnumMap, e)) - .toList() ?? - const [], - nullableEnumList: (json['nullableEnumList'] as List?) + id: json['id'] as String, + enumValue: + $enumDecodeNullable(_$TestEnumEnumMap, json['enumValue']) ?? TestEnum.one, + nullableEnumValue: $enumDecodeNullable( + _$TestEnumEnumMap, + json['nullableEnumValue'], + ), + enumList: + (json['enumList'] as List?) ?.map((e) => $enumDecode(_$TestEnumEnumMap, e)) - .toList(), - ); + .toList() ?? + const [], + nullableEnumList: (json['nullableEnumList'] as List?) + ?.map((e) => $enumDecode(_$TestEnumEnumMap, e)) + .toList(), +); const _$EnumsFieldMap = { 'id': 'id', @@ -1831,13 +1896,14 @@ abstract class _$EnumsPerFieldToJson { } Map _$EnumsToJson(Enums instance) => { - 'id': instance.id, - 'enumValue': _$TestEnumEnumMap[instance.enumValue]!, - 'nullableEnumValue': _$TestEnumEnumMap[instance.nullableEnumValue], - 'enumList': instance.enumList.map((e) => _$TestEnumEnumMap[e]!).toList(), - 'nullableEnumList': - instance.nullableEnumList?.map((e) => _$TestEnumEnumMap[e]!).toList(), - }; + 'id': instance.id, + 'enumValue': _$TestEnumEnumMap[instance.enumValue]!, + 'nullableEnumValue': _$TestEnumEnumMap[instance.nullableEnumValue], + 'enumList': instance.enumList.map((e) => _$TestEnumEnumMap[e]!).toList(), + 'nullableEnumList': instance.nullableEnumList + ?.map((e) => _$TestEnumEnumMap[e]!) + .toList(), +}; const _$TestEnumEnumMap = { TestEnum.one: 'one', diff --git a/packages/cloud_firestore_odm/example/lib/integration/freezed.freezed.dart b/packages/cloud_firestore_odm/example/lib/integration/freezed.freezed.dart index cbe46b2..268bc1b 100644 --- a/packages/cloud_firestore_odm/example/lib/integration/freezed.freezed.dart +++ b/packages/cloud_firestore_odm/example/lib/integration/freezed.freezed.dart @@ -14,406 +14,323 @@ T _$identity(T value) => value; /// @nodoc mixin _$Person { - String get firstName; - @JsonKey(name: 'LAST_NAME') - String get lastName; - @JsonKey(includeFromJson: false, includeToJson: false) - int? get ignored; - - /// Create a copy of Person - /// with the given fields replaced by the non-null parameter values. - @JsonKey(includeFromJson: false, includeToJson: false) - @pragma('vm:prefer-inline') - $PersonCopyWith get copyWith => - _$PersonCopyWithImpl(this as Person, _$identity); + + String get firstName;@JsonKey(name: 'LAST_NAME') String get lastName;@JsonKey(includeFromJson: false, includeToJson: false) int? get ignored; +/// Create a copy of Person +/// with the given fields replaced by the non-null parameter values. +@JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +$PersonCopyWith get copyWith => _$PersonCopyWithImpl(this as Person, _$identity); /// Serializes this Person to a JSON map. Map toJson(); - @override - bool operator ==(Object other) { - return identical(this, other) || - (other.runtimeType == runtimeType && - other is Person && - (identical(other.firstName, firstName) || - other.firstName == firstName) && - (identical(other.lastName, lastName) || - other.lastName == lastName) && - (identical(other.ignored, ignored) || other.ignored == ignored)); - } - @JsonKey(includeFromJson: false, includeToJson: false) - @override - int get hashCode => Object.hash(runtimeType, firstName, lastName, ignored); +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is Person&&(identical(other.firstName, firstName) || other.firstName == firstName)&&(identical(other.lastName, lastName) || other.lastName == lastName)&&(identical(other.ignored, ignored) || other.ignored == ignored)); +} + +@JsonKey(includeFromJson: false, includeToJson: false) +@override +int get hashCode => Object.hash(runtimeType,firstName,lastName,ignored); - @override - String toString() { - return 'Person(firstName: $firstName, lastName: $lastName, ignored: $ignored)'; - } +@override +String toString() { + return 'Person(firstName: $firstName, lastName: $lastName, ignored: $ignored)'; } -/// @nodoc -abstract mixin class $PersonCopyWith<$Res> { - factory $PersonCopyWith(Person value, $Res Function(Person) _then) = - _$PersonCopyWithImpl; - @useResult - $Res call( - {String firstName, - @JsonKey(name: 'LAST_NAME') String lastName, - @JsonKey(includeFromJson: false, includeToJson: false) int? ignored}); + } /// @nodoc -class _$PersonCopyWithImpl<$Res> implements $PersonCopyWith<$Res> { +abstract mixin class $PersonCopyWith<$Res> { + factory $PersonCopyWith(Person value, $Res Function(Person) _then) = _$PersonCopyWithImpl; +@useResult +$Res call({ + String firstName,@JsonKey(name: 'LAST_NAME') String lastName,@JsonKey(includeFromJson: false, includeToJson: false) int? ignored +}); + + + + +} +/// @nodoc +class _$PersonCopyWithImpl<$Res> + implements $PersonCopyWith<$Res> { _$PersonCopyWithImpl(this._self, this._then); final Person _self; final $Res Function(Person) _then; - /// Create a copy of Person - /// with the given fields replaced by the non-null parameter values. - @pragma('vm:prefer-inline') - @override - $Res call({ - Object? firstName = null, - Object? lastName = null, - Object? ignored = freezed, - }) { - return _then(_self.copyWith( - firstName: null == firstName - ? _self.firstName - : firstName // ignore: cast_nullable_to_non_nullable - as String, - lastName: null == lastName - ? _self.lastName - : lastName // ignore: cast_nullable_to_non_nullable - as String, - ignored: freezed == ignored - ? _self.ignored - : ignored // ignore: cast_nullable_to_non_nullable - as int?, - )); - } +/// Create a copy of Person +/// with the given fields replaced by the non-null parameter values. +@pragma('vm:prefer-inline') @override $Res call({Object? firstName = null,Object? lastName = null,Object? ignored = freezed,}) { + return _then(_self.copyWith( +firstName: null == firstName ? _self.firstName : firstName // ignore: cast_nullable_to_non_nullable +as String,lastName: null == lastName ? _self.lastName : lastName // ignore: cast_nullable_to_non_nullable +as String,ignored: freezed == ignored ? _self.ignored : ignored // ignore: cast_nullable_to_non_nullable +as int?, + )); } +} + + /// Adds pattern-matching-related methods to [Person]. extension PersonPatterns on Person { - /// A variant of `map` that fallback to returning `orElse`. - /// - /// It is equivalent to doing: - /// ```dart - /// switch (sealedClass) { - /// case final Subclass value: - /// return ...; - /// case _: - /// return orElse(); - /// } - /// ``` - - @optionalTypeArgs - TResult maybeMap( - TResult Function(_Person value)? $default, { - required TResult orElse(), - }) { - final _that = this; - switch (_that) { - case _Person() when $default != null: - return $default(_that); - case _: - return orElse(); - } - } - - /// A `switch`-like method, using callbacks. - /// - /// Callbacks receives the raw object, upcasted. - /// It is equivalent to doing: - /// ```dart - /// switch (sealedClass) { - /// case final Subclass value: - /// return ...; - /// case final Subclass2 value: - /// return ...; - /// } - /// ``` - - @optionalTypeArgs - TResult map( - TResult Function(_Person value) $default, - ) { - final _that = this; - switch (_that) { - case _Person(): - return $default(_that); - case _: - throw StateError('Unexpected subclass'); - } - } - - /// A variant of `map` that fallback to returning `null`. - /// - /// It is equivalent to doing: - /// ```dart - /// switch (sealedClass) { - /// case final Subclass value: - /// return ...; - /// case _: - /// return null; - /// } - /// ``` - - @optionalTypeArgs - TResult? mapOrNull( - TResult? Function(_Person value)? $default, - ) { - final _that = this; - switch (_that) { - case _Person() when $default != null: - return $default(_that); - case _: - return null; - } - } - - /// A variant of `when` that fallback to an `orElse` callback. - /// - /// It is equivalent to doing: - /// ```dart - /// switch (sealedClass) { - /// case Subclass(:final field): - /// return ...; - /// case _: - /// return orElse(); - /// } - /// ``` - - @optionalTypeArgs - TResult maybeWhen( - TResult Function( - String firstName, - @JsonKey(name: 'LAST_NAME') String lastName, - @JsonKey(includeFromJson: false, includeToJson: false) - int? ignored)? - $default, { - required TResult orElse(), - }) { - final _that = this; - switch (_that) { - case _Person() when $default != null: - return $default(_that.firstName, _that.lastName, _that.ignored); - case _: - return orElse(); - } - } - - /// A `switch`-like method, using callbacks. - /// - /// As opposed to `map`, this offers destructuring. - /// It is equivalent to doing: - /// ```dart - /// switch (sealedClass) { - /// case Subclass(:final field): - /// return ...; - /// case Subclass2(:final field2): - /// return ...; - /// } - /// ``` - - @optionalTypeArgs - TResult when( - TResult Function( - String firstName, - @JsonKey(name: 'LAST_NAME') String lastName, - @JsonKey(includeFromJson: false, includeToJson: false) int? ignored) - $default, - ) { - final _that = this; - switch (_that) { - case _Person(): - return $default(_that.firstName, _that.lastName, _that.ignored); - case _: - throw StateError('Unexpected subclass'); - } - } - - /// A variant of `when` that fallback to returning `null` - /// - /// It is equivalent to doing: - /// ```dart - /// switch (sealedClass) { - /// case Subclass(:final field): - /// return ...; - /// case _: - /// return null; - /// } - /// ``` - - @optionalTypeArgs - TResult? whenOrNull( - TResult? Function( - String firstName, - @JsonKey(name: 'LAST_NAME') String lastName, - @JsonKey(includeFromJson: false, includeToJson: false) - int? ignored)? - $default, - ) { - final _that = this; - switch (_that) { - case _Person() when $default != null: - return $default(_that.firstName, _that.lastName, _that.ignored); - case _: - return null; - } - } +/// A variant of `map` that fallback to returning `orElse`. +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case final Subclass value: +/// return ...; +/// case _: +/// return orElse(); +/// } +/// ``` + +@optionalTypeArgs TResult maybeMap(TResult Function( _Person value)? $default,{required TResult orElse(),}){ +final _that = this; +switch (_that) { +case _Person() when $default != null: +return $default(_that);case _: + return orElse(); + +} +} +/// A `switch`-like method, using callbacks. +/// +/// Callbacks receives the raw object, upcasted. +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case final Subclass value: +/// return ...; +/// case final Subclass2 value: +/// return ...; +/// } +/// ``` + +@optionalTypeArgs TResult map(TResult Function( _Person value) $default,){ +final _that = this; +switch (_that) { +case _Person(): +return $default(_that);case _: + throw StateError('Unexpected subclass'); + +} +} +/// A variant of `map` that fallback to returning `null`. +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case final Subclass value: +/// return ...; +/// case _: +/// return null; +/// } +/// ``` + +@optionalTypeArgs TResult? mapOrNull(TResult? Function( _Person value)? $default,){ +final _that = this; +switch (_that) { +case _Person() when $default != null: +return $default(_that);case _: + return null; + +} +} +/// A variant of `when` that fallback to an `orElse` callback. +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case Subclass(:final field): +/// return ...; +/// case _: +/// return orElse(); +/// } +/// ``` + +@optionalTypeArgs TResult maybeWhen(TResult Function( String firstName, @JsonKey(name: 'LAST_NAME') String lastName, @JsonKey(includeFromJson: false, includeToJson: false) int? ignored)? $default,{required TResult orElse(),}) {final _that = this; +switch (_that) { +case _Person() when $default != null: +return $default(_that.firstName,_that.lastName,_that.ignored);case _: + return orElse(); + +} +} +/// A `switch`-like method, using callbacks. +/// +/// As opposed to `map`, this offers destructuring. +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case Subclass(:final field): +/// return ...; +/// case Subclass2(:final field2): +/// return ...; +/// } +/// ``` + +@optionalTypeArgs TResult when(TResult Function( String firstName, @JsonKey(name: 'LAST_NAME') String lastName, @JsonKey(includeFromJson: false, includeToJson: false) int? ignored) $default,) {final _that = this; +switch (_that) { +case _Person(): +return $default(_that.firstName,_that.lastName,_that.ignored);case _: + throw StateError('Unexpected subclass'); + +} +} +/// A variant of `when` that fallback to returning `null` +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case Subclass(:final field): +/// return ...; +/// case _: +/// return null; +/// } +/// ``` + +@optionalTypeArgs TResult? whenOrNull(TResult? Function( String firstName, @JsonKey(name: 'LAST_NAME') String lastName, @JsonKey(includeFromJson: false, includeToJson: false) int? ignored)? $default,) {final _that = this; +switch (_that) { +case _Person() when $default != null: +return $default(_that.firstName,_that.lastName,_that.ignored);case _: + return null; + +} +} + } /// @nodoc @JsonSerializable(fieldRename: FieldRename.snake) class _Person implements Person { - _Person( - {required this.firstName, - @JsonKey(name: 'LAST_NAME') required this.lastName, - @JsonKey(includeFromJson: false, includeToJson: false) this.ignored}); + _Person({required this.firstName, @JsonKey(name: 'LAST_NAME') required this.lastName, @JsonKey(includeFromJson: false, includeToJson: false) this.ignored}); factory _Person.fromJson(Map json) => _$PersonFromJson(json); - @override - final String firstName; - @override - @JsonKey(name: 'LAST_NAME') - final String lastName; - @override - @JsonKey(includeFromJson: false, includeToJson: false) - final int? ignored; - - /// Create a copy of Person - /// with the given fields replaced by the non-null parameter values. - @override - @JsonKey(includeFromJson: false, includeToJson: false) - @pragma('vm:prefer-inline') - _$PersonCopyWith<_Person> get copyWith => - __$PersonCopyWithImpl<_Person>(this, _$identity); - - @override - Map toJson() { - return _$PersonToJson( - this, - ); - } - - @override - bool operator ==(Object other) { - return identical(this, other) || - (other.runtimeType == runtimeType && - other is _Person && - (identical(other.firstName, firstName) || - other.firstName == firstName) && - (identical(other.lastName, lastName) || - other.lastName == lastName) && - (identical(other.ignored, ignored) || other.ignored == ignored)); - } - - @JsonKey(includeFromJson: false, includeToJson: false) - @override - int get hashCode => Object.hash(runtimeType, firstName, lastName, ignored); - - @override - String toString() { - return 'Person(firstName: $firstName, lastName: $lastName, ignored: $ignored)'; - } +@override final String firstName; +@override@JsonKey(name: 'LAST_NAME') final String lastName; +@override@JsonKey(includeFromJson: false, includeToJson: false) final int? ignored; + +/// Create a copy of Person +/// with the given fields replaced by the non-null parameter values. +@override @JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +_$PersonCopyWith<_Person> get copyWith => __$PersonCopyWithImpl<_Person>(this, _$identity); + +@override +Map toJson() { + return _$PersonToJson(this, ); +} + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is _Person&&(identical(other.firstName, firstName) || other.firstName == firstName)&&(identical(other.lastName, lastName) || other.lastName == lastName)&&(identical(other.ignored, ignored) || other.ignored == ignored)); +} + +@JsonKey(includeFromJson: false, includeToJson: false) +@override +int get hashCode => Object.hash(runtimeType,firstName,lastName,ignored); + +@override +String toString() { + return 'Person(firstName: $firstName, lastName: $lastName, ignored: $ignored)'; +} + + } /// @nodoc abstract mixin class _$PersonCopyWith<$Res> implements $PersonCopyWith<$Res> { - factory _$PersonCopyWith(_Person value, $Res Function(_Person) _then) = - __$PersonCopyWithImpl; - @override - @useResult - $Res call( - {String firstName, - @JsonKey(name: 'LAST_NAME') String lastName, - @JsonKey(includeFromJson: false, includeToJson: false) int? ignored}); -} + factory _$PersonCopyWith(_Person value, $Res Function(_Person) _then) = __$PersonCopyWithImpl; +@override @useResult +$Res call({ + String firstName,@JsonKey(name: 'LAST_NAME') String lastName,@JsonKey(includeFromJson: false, includeToJson: false) int? ignored +}); + + + +} /// @nodoc -class __$PersonCopyWithImpl<$Res> implements _$PersonCopyWith<$Res> { +class __$PersonCopyWithImpl<$Res> + implements _$PersonCopyWith<$Res> { __$PersonCopyWithImpl(this._self, this._then); final _Person _self; final $Res Function(_Person) _then; - /// Create a copy of Person - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $Res call({ - Object? firstName = null, - Object? lastName = null, - Object? ignored = freezed, - }) { - return _then(_Person( - firstName: null == firstName - ? _self.firstName - : firstName // ignore: cast_nullable_to_non_nullable - as String, - lastName: null == lastName - ? _self.lastName - : lastName // ignore: cast_nullable_to_non_nullable - as String, - ignored: freezed == ignored - ? _self.ignored - : ignored // ignore: cast_nullable_to_non_nullable - as int?, - )); - } -} - -PublicRedirected _$PublicRedirectedFromJson(Map json) { - return PublicRedirected2.fromJson(json); +/// Create a copy of Person +/// with the given fields replaced by the non-null parameter values. +@override @pragma('vm:prefer-inline') $Res call({Object? firstName = null,Object? lastName = null,Object? ignored = freezed,}) { + return _then(_Person( +firstName: null == firstName ? _self.firstName : firstName // ignore: cast_nullable_to_non_nullable +as String,lastName: null == lastName ? _self.lastName : lastName // ignore: cast_nullable_to_non_nullable +as String,ignored: freezed == ignored ? _self.ignored : ignored // ignore: cast_nullable_to_non_nullable +as int?, + )); +} + + +} + +PublicRedirected _$PublicRedirectedFromJson( + Map json +) { + return PublicRedirected2.fromJson( + json + ); } /// @nodoc mixin _$PublicRedirected { - String get value; - /// Create a copy of PublicRedirected - /// with the given fields replaced by the non-null parameter values. - @JsonKey(includeFromJson: false, includeToJson: false) - @pragma('vm:prefer-inline') - $PublicRedirectedCopyWith get copyWith => - _$PublicRedirectedCopyWithImpl( - this as PublicRedirected, _$identity); + String get value; +/// Create a copy of PublicRedirected +/// with the given fields replaced by the non-null parameter values. +@JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +$PublicRedirectedCopyWith get copyWith => _$PublicRedirectedCopyWithImpl(this as PublicRedirected, _$identity); /// Serializes this PublicRedirected to a JSON map. Map toJson(); - @override - bool operator ==(Object other) { - return identical(this, other) || - (other.runtimeType == runtimeType && - other is PublicRedirected && - (identical(other.value, value) || other.value == value)); - } - @JsonKey(includeFromJson: false, includeToJson: false) - @override - int get hashCode => Object.hash(runtimeType, value); +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is PublicRedirected&&(identical(other.value, value) || other.value == value)); +} + +@JsonKey(includeFromJson: false, includeToJson: false) +@override +int get hashCode => Object.hash(runtimeType,value); - @override - String toString() { - return 'PublicRedirected(value: $value)'; - } +@override +String toString() { + return 'PublicRedirected(value: $value)'; } -/// @nodoc -abstract mixin class $PublicRedirectedCopyWith<$Res> { - factory $PublicRedirectedCopyWith( - PublicRedirected value, $Res Function(PublicRedirected) _then) = - _$PublicRedirectedCopyWithImpl; - @useResult - $Res call({String value}); + } +/// @nodoc +abstract mixin class $PublicRedirectedCopyWith<$Res> { + factory $PublicRedirectedCopyWith(PublicRedirected value, $Res Function(PublicRedirected) _then) = _$PublicRedirectedCopyWithImpl; +@useResult +$Res call({ + String value +}); + + + + +} /// @nodoc class _$PublicRedirectedCopyWithImpl<$Res> implements $PublicRedirectedCopyWith<$Res> { @@ -422,233 +339,197 @@ class _$PublicRedirectedCopyWithImpl<$Res> final PublicRedirected _self; final $Res Function(PublicRedirected) _then; - /// Create a copy of PublicRedirected - /// with the given fields replaced by the non-null parameter values. - @pragma('vm:prefer-inline') - @override - $Res call({ - Object? value = null, - }) { - return _then(_self.copyWith( - value: null == value - ? _self.value - : value // ignore: cast_nullable_to_non_nullable - as String, - )); - } +/// Create a copy of PublicRedirected +/// with the given fields replaced by the non-null parameter values. +@pragma('vm:prefer-inline') @override $Res call({Object? value = null,}) { + return _then(_self.copyWith( +value: null == value ? _self.value : value // ignore: cast_nullable_to_non_nullable +as String, + )); +} + } + /// Adds pattern-matching-related methods to [PublicRedirected]. extension PublicRedirectedPatterns on PublicRedirected { - /// A variant of `map` that fallback to returning `orElse`. - /// - /// It is equivalent to doing: - /// ```dart - /// switch (sealedClass) { - /// case final Subclass value: - /// return ...; - /// case _: - /// return orElse(); - /// } - /// ``` - - @optionalTypeArgs - TResult maybeMap( - TResult Function(PublicRedirected2 value)? $default, { - required TResult orElse(), - }) { - final _that = this; - switch (_that) { - case PublicRedirected2() when $default != null: - return $default(_that); - case _: - return orElse(); - } - } - - /// A `switch`-like method, using callbacks. - /// - /// Callbacks receives the raw object, upcasted. - /// It is equivalent to doing: - /// ```dart - /// switch (sealedClass) { - /// case final Subclass value: - /// return ...; - /// case final Subclass2 value: - /// return ...; - /// } - /// ``` - - @optionalTypeArgs - TResult map( - TResult Function(PublicRedirected2 value) $default, - ) { - final _that = this; - switch (_that) { - case PublicRedirected2(): - return $default(_that); - case _: - throw StateError('Unexpected subclass'); - } - } - - /// A variant of `map` that fallback to returning `null`. - /// - /// It is equivalent to doing: - /// ```dart - /// switch (sealedClass) { - /// case final Subclass value: - /// return ...; - /// case _: - /// return null; - /// } - /// ``` - - @optionalTypeArgs - TResult? mapOrNull( - TResult? Function(PublicRedirected2 value)? $default, - ) { - final _that = this; - switch (_that) { - case PublicRedirected2() when $default != null: - return $default(_that); - case _: - return null; - } - } - - /// A variant of `when` that fallback to an `orElse` callback. - /// - /// It is equivalent to doing: - /// ```dart - /// switch (sealedClass) { - /// case Subclass(:final field): - /// return ...; - /// case _: - /// return orElse(); - /// } - /// ``` - - @optionalTypeArgs - TResult maybeWhen( - TResult Function(String value)? $default, { - required TResult orElse(), - }) { - final _that = this; - switch (_that) { - case PublicRedirected2() when $default != null: - return $default(_that.value); - case _: - return orElse(); - } - } - - /// A `switch`-like method, using callbacks. - /// - /// As opposed to `map`, this offers destructuring. - /// It is equivalent to doing: - /// ```dart - /// switch (sealedClass) { - /// case Subclass(:final field): - /// return ...; - /// case Subclass2(:final field2): - /// return ...; - /// } - /// ``` - - @optionalTypeArgs - TResult when( - TResult Function(String value) $default, - ) { - final _that = this; - switch (_that) { - case PublicRedirected2(): - return $default(_that.value); - case _: - throw StateError('Unexpected subclass'); - } - } - - /// A variant of `when` that fallback to returning `null` - /// - /// It is equivalent to doing: - /// ```dart - /// switch (sealedClass) { - /// case Subclass(:final field): - /// return ...; - /// case _: - /// return null; - /// } - /// ``` - - @optionalTypeArgs - TResult? whenOrNull( - TResult? Function(String value)? $default, - ) { - final _that = this; - switch (_that) { - case PublicRedirected2() when $default != null: - return $default(_that.value); - case _: - return null; - } - } +/// A variant of `map` that fallback to returning `orElse`. +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case final Subclass value: +/// return ...; +/// case _: +/// return orElse(); +/// } +/// ``` + +@optionalTypeArgs TResult maybeMap(TResult Function( PublicRedirected2 value)? $default,{required TResult orElse(),}){ +final _that = this; +switch (_that) { +case PublicRedirected2() when $default != null: +return $default(_that);case _: + return orElse(); + +} +} +/// A `switch`-like method, using callbacks. +/// +/// Callbacks receives the raw object, upcasted. +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case final Subclass value: +/// return ...; +/// case final Subclass2 value: +/// return ...; +/// } +/// ``` + +@optionalTypeArgs TResult map(TResult Function( PublicRedirected2 value) $default,){ +final _that = this; +switch (_that) { +case PublicRedirected2(): +return $default(_that);case _: + throw StateError('Unexpected subclass'); + +} +} +/// A variant of `map` that fallback to returning `null`. +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case final Subclass value: +/// return ...; +/// case _: +/// return null; +/// } +/// ``` + +@optionalTypeArgs TResult? mapOrNull(TResult? Function( PublicRedirected2 value)? $default,){ +final _that = this; +switch (_that) { +case PublicRedirected2() when $default != null: +return $default(_that);case _: + return null; + +} +} +/// A variant of `when` that fallback to an `orElse` callback. +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case Subclass(:final field): +/// return ...; +/// case _: +/// return orElse(); +/// } +/// ``` + +@optionalTypeArgs TResult maybeWhen(TResult Function( String value)? $default,{required TResult orElse(),}) {final _that = this; +switch (_that) { +case PublicRedirected2() when $default != null: +return $default(_that.value);case _: + return orElse(); + +} +} +/// A `switch`-like method, using callbacks. +/// +/// As opposed to `map`, this offers destructuring. +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case Subclass(:final field): +/// return ...; +/// case Subclass2(:final field2): +/// return ...; +/// } +/// ``` + +@optionalTypeArgs TResult when(TResult Function( String value) $default,) {final _that = this; +switch (_that) { +case PublicRedirected2(): +return $default(_that.value);case _: + throw StateError('Unexpected subclass'); + +} +} +/// A variant of `when` that fallback to returning `null` +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case Subclass(:final field): +/// return ...; +/// case _: +/// return null; +/// } +/// ``` + +@optionalTypeArgs TResult? whenOrNull(TResult? Function( String value)? $default,) {final _that = this; +switch (_that) { +case PublicRedirected2() when $default != null: +return $default(_that.value);case _: + return null; + +} +} + } /// @nodoc @JsonSerializable() + class PublicRedirected2 implements PublicRedirected { - PublicRedirected2({required this.value}); - factory PublicRedirected2.fromJson(Map json) => - _$PublicRedirected2FromJson(json); - - @override - final String value; - - /// Create a copy of PublicRedirected - /// with the given fields replaced by the non-null parameter values. - @override - @JsonKey(includeFromJson: false, includeToJson: false) - @pragma('vm:prefer-inline') - $PublicRedirected2CopyWith get copyWith => - _$PublicRedirected2CopyWithImpl(this, _$identity); - - @override - Map toJson() { - return _$PublicRedirected2ToJson( - this, - ); - } + PublicRedirected2({required this.value}); + factory PublicRedirected2.fromJson(Map json) => _$PublicRedirected2FromJson(json); - @override - bool operator ==(Object other) { - return identical(this, other) || - (other.runtimeType == runtimeType && - other is PublicRedirected2 && - (identical(other.value, value) || other.value == value)); - } +@override final String value; - @JsonKey(includeFromJson: false, includeToJson: false) - @override - int get hashCode => Object.hash(runtimeType, value); +/// Create a copy of PublicRedirected +/// with the given fields replaced by the non-null parameter values. +@override @JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +$PublicRedirected2CopyWith get copyWith => _$PublicRedirected2CopyWithImpl(this, _$identity); - @override - String toString() { - return 'PublicRedirected(value: $value)'; - } +@override +Map toJson() { + return _$PublicRedirected2ToJson(this, ); } -/// @nodoc -abstract mixin class $PublicRedirected2CopyWith<$Res> - implements $PublicRedirectedCopyWith<$Res> { - factory $PublicRedirected2CopyWith( - PublicRedirected2 value, $Res Function(PublicRedirected2) _then) = - _$PublicRedirected2CopyWithImpl; - @override - @useResult - $Res call({String value}); +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is PublicRedirected2&&(identical(other.value, value) || other.value == value)); +} + +@JsonKey(includeFromJson: false, includeToJson: false) +@override +int get hashCode => Object.hash(runtimeType,value); + +@override +String toString() { + return 'PublicRedirected(value: $value)'; +} + + } +/// @nodoc +abstract mixin class $PublicRedirected2CopyWith<$Res> implements $PublicRedirectedCopyWith<$Res> { + factory $PublicRedirected2CopyWith(PublicRedirected2 value, $Res Function(PublicRedirected2) _then) = _$PublicRedirected2CopyWithImpl; +@override @useResult +$Res call({ + String value +}); + + + + +} /// @nodoc class _$PublicRedirected2CopyWithImpl<$Res> implements $PublicRedirected2CopyWith<$Res> { @@ -657,20 +538,16 @@ class _$PublicRedirected2CopyWithImpl<$Res> final PublicRedirected2 _self; final $Res Function(PublicRedirected2) _then; - /// Create a copy of PublicRedirected - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $Res call({ - Object? value = null, - }) { - return _then(PublicRedirected2( - value: null == value - ? _self.value - : value // ignore: cast_nullable_to_non_nullable - as String, - )); - } +/// Create a copy of PublicRedirected +/// with the given fields replaced by the non-null parameter values. +@override @pragma('vm:prefer-inline') $Res call({Object? value = null,}) { + return _then(PublicRedirected2( +value: null == value ? _self.value : value // ignore: cast_nullable_to_non_nullable +as String, + )); +} + + } // dart format on diff --git a/packages/cloud_firestore_odm/example/lib/integration/freezed.g.dart b/packages/cloud_firestore_odm/example/lib/integration/freezed.g.dart index 87b2361..16371f8 100644 --- a/packages/cloud_firestore_odm/example/lib/integration/freezed.g.dart +++ b/packages/cloud_firestore_odm/example/lib/integration/freezed.g.dart @@ -26,9 +26,8 @@ abstract class PersonCollectionReference implements PersonQuery, FirestoreCollectionReference { - factory PersonCollectionReference([ - FirebaseFirestore? firestore, - ]) = _$PersonCollectionReference; + factory PersonCollectionReference([FirebaseFirestore? firestore]) = + _$PersonCollectionReference; static Person fromFirestore( DocumentSnapshot> snapshot, @@ -37,10 +36,7 @@ abstract class PersonCollectionReference return Person.fromJson(snapshot.data()!); } - static Map toFirestore( - Person value, - SetOptions? options, - ) { + static Map toFirestore(Person value, SetOptions? options) { return value.toJson(); } @@ -61,16 +57,17 @@ class _$PersonCollectionReference extends _$PersonQuery firestore ??= FirebaseFirestore.instance; return _$PersonCollectionReference._( - firestore.collection('freezed-test').withConverter( + firestore + .collection('freezed-test') + .withConverter( fromFirestore: PersonCollectionReference.fromFirestore, toFirestore: PersonCollectionReference.toFirestore, ), ); } - _$PersonCollectionReference._( - CollectionReference reference, - ) : super(reference, $referenceWithoutCursor: reference); + _$PersonCollectionReference._(CollectionReference reference) + : super(reference, $referenceWithoutCursor: reference); String get path => reference.path; @@ -84,9 +81,7 @@ class _$PersonCollectionReference extends _$PersonQuery id == null || id.split('/').length == 1, 'The document ID cannot be from a different collection', ); - return PersonDocumentReference( - reference.doc(id), - ); + return PersonDocumentReference(reference.doc(id)); } @override @@ -243,6 +238,7 @@ class _$PersonDocumentReference ...model.toJson(), if (firstNameFieldValue != null) _$PersonFieldMap['firstName']!: firstNameFieldValue, + if (lastNameFieldValue != null) _$PersonFieldMap['lastName']!: lastNameFieldValue, }; @@ -265,6 +261,7 @@ class _$PersonDocumentReference ...model.toJson(), if (firstNameFieldValue != null) _$PersonFieldMap['firstName']!: firstNameFieldValue, + if (lastNameFieldValue != null) _$PersonFieldMap['lastName']!: lastNameFieldValue, }; @@ -287,6 +284,7 @@ class _$PersonDocumentReference ...model.toJson(), if (firstNameFieldValue != null) _$PersonFieldMap['firstName']!: firstNameFieldValue, + if (lastNameFieldValue != null) _$PersonFieldMap['lastName']!: lastNameFieldValue, }; @@ -314,13 +312,18 @@ class _$PersonDocumentReference ); final json = { if (firstName != _sentinel) - _$PersonFieldMap['firstName']!: - _$PersonPerFieldToJson.firstName(firstName as String), + _$PersonFieldMap['firstName']!: _$PersonPerFieldToJson.firstName( + firstName as String, + ), + if (firstNameFieldValue != null) _$PersonFieldMap['firstName']!: firstNameFieldValue, + if (lastName != _sentinel) - _$PersonFieldMap['lastName']!: - _$PersonPerFieldToJson.lastName(lastName as String), + _$PersonFieldMap['lastName']!: _$PersonPerFieldToJson.lastName( + lastName as String, + ), + if (lastNameFieldValue != null) _$PersonFieldMap['lastName']!: lastNameFieldValue, }; @@ -345,13 +348,18 @@ class _$PersonDocumentReference ); final json = { if (firstName != _sentinel) - _$PersonFieldMap['firstName']!: - _$PersonPerFieldToJson.firstName(firstName as String), + _$PersonFieldMap['firstName']!: _$PersonPerFieldToJson.firstName( + firstName as String, + ), + if (firstNameFieldValue != null) _$PersonFieldMap['firstName']!: firstNameFieldValue, + if (lastName != _sentinel) - _$PersonFieldMap['lastName']!: - _$PersonPerFieldToJson.lastName(lastName as String), + _$PersonFieldMap['lastName']!: _$PersonPerFieldToJson.lastName( + lastName as String, + ), + if (lastNameFieldValue != null) _$PersonFieldMap['lastName']!: lastNameFieldValue, }; @@ -376,13 +384,18 @@ class _$PersonDocumentReference ); final json = { if (firstName != _sentinel) - _$PersonFieldMap['firstName']!: - _$PersonPerFieldToJson.firstName(firstName as String), + _$PersonFieldMap['firstName']!: _$PersonPerFieldToJson.firstName( + firstName as String, + ), + if (firstNameFieldValue != null) _$PersonFieldMap['firstName']!: firstNameFieldValue, + if (lastName != _sentinel) - _$PersonFieldMap['lastName']!: - _$PersonPerFieldToJson.lastName(lastName as String), + _$PersonFieldMap['lastName']!: _$PersonPerFieldToJson.lastName( + lastName as String, + ), + if (lastNameFieldValue != null) _$PersonFieldMap['lastName']!: lastNameFieldValue, }; @@ -555,9 +568,9 @@ class _$PersonQuery extends QueryReference required Query $referenceWithoutCursor, $QueryCursor $queryCursor = const $QueryCursor(), }) : super( - $referenceWithoutCursor: $referenceWithoutCursor, - $queryCursor: $queryCursor, - ); + $referenceWithoutCursor: $referenceWithoutCursor, + $queryCursor: $queryCursor, + ); final CollectionReference _collection; @@ -618,7 +631,8 @@ class _$PersonQuery extends QueryReference arrayContainsAny: arrayContainsAny, whereIn: whereIn, whereNotIn: whereNotIn, - isNull: isNull ?? + isNull: + isNull ?? (isEqualTo == null ? false : null) ?? (isNotEqualTo == null ? true : null), ), @@ -650,7 +664,8 @@ class _$PersonQuery extends QueryReference isGreaterThanOrEqualTo: isGreaterThanOrEqualTo, whereIn: whereIn, whereNotIn: whereNotIn, - isNull: isNull ?? + isNull: + isNull ?? (isEqualTo == null ? false : null) ?? (isNotEqualTo == null ? true : null), ), @@ -694,7 +709,8 @@ class _$PersonQuery extends QueryReference : null, whereIn: whereIn?.map((e) => _$PersonPerFieldToJson.firstName(e)), whereNotIn: whereNotIn?.map((e) => _$PersonPerFieldToJson.firstName(e)), - isNull: isNull ?? + isNull: + isNull ?? (isEqualTo == null ? false : null) ?? (isNotEqualTo == null ? true : null), ), @@ -738,7 +754,8 @@ class _$PersonQuery extends QueryReference : null, whereIn: whereIn?.map((e) => _$PersonPerFieldToJson.lastName(e)), whereNotIn: whereNotIn?.map((e) => _$PersonPerFieldToJson.lastName(e)), - isNull: isNull ?? + isNull: + isNull ?? (isEqualTo == null ? false : null) ?? (isNotEqualTo == null ? true : null), ), @@ -759,8 +776,10 @@ class _$PersonQuery extends QueryReference PersonDocumentSnapshot? endBeforeDocument, PersonDocumentSnapshot? startAfterDocument, }) { - final query = - $referenceWithoutCursor.orderBy(fieldPath, descending: descending); + final query = $referenceWithoutCursor.orderBy( + fieldPath, + descending: descending, + ); var queryCursor = $queryCursor; if (startAtDocument != null) { @@ -832,8 +851,10 @@ class _$PersonQuery extends QueryReference PersonDocumentSnapshot? endBeforeDocument, PersonDocumentSnapshot? startAfterDocument, }) { - final query = $referenceWithoutCursor.orderBy(FieldPath.documentId, - descending: descending); + final query = $referenceWithoutCursor.orderBy( + FieldPath.documentId, + descending: descending, + ); var queryCursor = $queryCursor; if (startAtDocument != null) { @@ -905,8 +926,10 @@ class _$PersonQuery extends QueryReference PersonDocumentSnapshot? endBeforeDocument, PersonDocumentSnapshot? startAfterDocument, }) { - final query = $referenceWithoutCursor - .orderBy(_$PersonFieldMap['firstName']!, descending: descending); + final query = $referenceWithoutCursor.orderBy( + _$PersonFieldMap['firstName']!, + descending: descending, + ); var queryCursor = $queryCursor; if (startAtDocument != null) { @@ -938,7 +961,7 @@ class _$PersonQuery extends QueryReference queryCursor = queryCursor.copyWith( startAt: [ ...queryCursor.startAt, - _$PersonPerFieldToJson.firstName(startAt as String) + _$PersonPerFieldToJson.firstName(startAt as String), ], startAtDocumentSnapshot: null, ); @@ -947,7 +970,7 @@ class _$PersonQuery extends QueryReference queryCursor = queryCursor.copyWith( startAfter: [ ...queryCursor.startAfter, - _$PersonPerFieldToJson.firstName(startAfter as String) + _$PersonPerFieldToJson.firstName(startAfter as String), ], startAfterDocumentSnapshot: null, ); @@ -956,7 +979,7 @@ class _$PersonQuery extends QueryReference queryCursor = queryCursor.copyWith( endAt: [ ...queryCursor.endAt, - _$PersonPerFieldToJson.firstName(endAt as String) + _$PersonPerFieldToJson.firstName(endAt as String), ], endAtDocumentSnapshot: null, ); @@ -965,7 +988,7 @@ class _$PersonQuery extends QueryReference queryCursor = queryCursor.copyWith( endBefore: [ ...queryCursor.endBefore, - _$PersonPerFieldToJson.firstName(endBefore as String) + _$PersonPerFieldToJson.firstName(endBefore as String), ], endBeforeDocumentSnapshot: null, ); @@ -990,8 +1013,10 @@ class _$PersonQuery extends QueryReference PersonDocumentSnapshot? endBeforeDocument, PersonDocumentSnapshot? startAfterDocument, }) { - final query = $referenceWithoutCursor.orderBy(_$PersonFieldMap['lastName']!, - descending: descending); + final query = $referenceWithoutCursor.orderBy( + _$PersonFieldMap['lastName']!, + descending: descending, + ); var queryCursor = $queryCursor; if (startAtDocument != null) { @@ -1023,7 +1048,7 @@ class _$PersonQuery extends QueryReference queryCursor = queryCursor.copyWith( startAt: [ ...queryCursor.startAt, - _$PersonPerFieldToJson.lastName(startAt as String) + _$PersonPerFieldToJson.lastName(startAt as String), ], startAtDocumentSnapshot: null, ); @@ -1032,7 +1057,7 @@ class _$PersonQuery extends QueryReference queryCursor = queryCursor.copyWith( startAfter: [ ...queryCursor.startAfter, - _$PersonPerFieldToJson.lastName(startAfter as String) + _$PersonPerFieldToJson.lastName(startAfter as String), ], startAfterDocumentSnapshot: null, ); @@ -1041,7 +1066,7 @@ class _$PersonQuery extends QueryReference queryCursor = queryCursor.copyWith( endAt: [ ...queryCursor.endAt, - _$PersonPerFieldToJson.lastName(endAt as String) + _$PersonPerFieldToJson.lastName(endAt as String), ], endAtDocumentSnapshot: null, ); @@ -1050,7 +1075,7 @@ class _$PersonQuery extends QueryReference queryCursor = queryCursor.copyWith( endBefore: [ ...queryCursor.endBefore, - _$PersonPerFieldToJson.lastName(endBefore as String) + _$PersonPerFieldToJson.lastName(endBefore as String), ], endBeforeDocumentSnapshot: null, ); @@ -1082,9 +1107,7 @@ class PersonDocumentSnapshot extends FirestoreDocumentSnapshot { @override PersonDocumentReference get reference { - return PersonDocumentReference( - snapshot.reference, - ); + return PersonDocumentReference(snapshot.reference); } @override @@ -1093,11 +1116,7 @@ class PersonDocumentSnapshot extends FirestoreDocumentSnapshot { class PersonQuerySnapshot extends FirestoreQuerySnapshot { - PersonQuerySnapshot._( - this.snapshot, - this.docs, - this.docChanges, - ); + PersonQuerySnapshot._(this.snapshot, this.docs, this.docChanges); factory PersonQuerySnapshot._fromQuerySnapshot( QuerySnapshot snapshot, @@ -1105,21 +1124,14 @@ class PersonQuerySnapshot final docs = snapshot.docs.map(PersonQueryDocumentSnapshot._).toList(); final docChanges = snapshot.docChanges.map((change) { - return _decodeDocumentChange( - change, - PersonDocumentSnapshot._, - ); + return _decodeDocumentChange(change, PersonDocumentSnapshot._); }).toList(); - return PersonQuerySnapshot._( - snapshot, - docs, - docChanges, - ); + return PersonQuerySnapshot._(snapshot, docs, docChanges); } static FirestoreDocumentChange - _decodeDocumentChange( + _decodeDocumentChange( DocumentChange docChange, PersonDocumentSnapshot Function(DocumentSnapshot doc) decodeDoc, ) { @@ -1162,11 +1174,12 @@ class PersonQueryDocumentSnapshot extends FirestoreQueryDocumentSnapshot abstract class PublicRedirectedCollectionReference implements PublicRedirectedQuery, - FirestoreCollectionReference { - factory PublicRedirectedCollectionReference([ - FirebaseFirestore? firestore, - ]) = _$PublicRedirectedCollectionReference; + FirestoreCollectionReference< + PublicRedirected, + PublicRedirectedQuerySnapshot + > { + factory PublicRedirectedCollectionReference([FirebaseFirestore? firestore]) = + _$PublicRedirectedCollectionReference; static PublicRedirected fromFirestore( DocumentSnapshot> snapshot, @@ -1195,12 +1208,15 @@ abstract class PublicRedirectedCollectionReference class _$PublicRedirectedCollectionReference extends _$PublicRedirectedQuery implements PublicRedirectedCollectionReference { - factory _$PublicRedirectedCollectionReference( - [FirebaseFirestore? firestore]) { + factory _$PublicRedirectedCollectionReference([ + FirebaseFirestore? firestore, + ]) { firestore ??= FirebaseFirestore.instance; return _$PublicRedirectedCollectionReference._( - firestore.collection('freezed-test').withConverter( + firestore + .collection('freezed-test') + .withConverter( fromFirestore: PublicRedirectedCollectionReference.fromFirestore, toFirestore: PublicRedirectedCollectionReference.toFirestore, ), @@ -1223,9 +1239,7 @@ class _$PublicRedirectedCollectionReference extends _$PublicRedirectedQuery id == null || id.split('/').length == 1, 'The document ID cannot be from a different collection', ); - return PublicRedirectedDocumentReference( - reference.doc(id), - ); + return PublicRedirectedDocumentReference(reference.doc(id)); } @override @@ -1247,11 +1261,14 @@ class _$PublicRedirectedCollectionReference extends _$PublicRedirectedQuery } abstract class PublicRedirectedDocumentReference - extends FirestoreDocumentReference { + extends + FirestoreDocumentReference< + PublicRedirected, + PublicRedirectedDocumentSnapshot + > { factory PublicRedirectedDocumentReference( - DocumentReference reference) = - _$PublicRedirectedDocumentReference; + DocumentReference reference, + ) = _$PublicRedirectedDocumentReference; DocumentReference get reference; @@ -1315,10 +1332,7 @@ abstract class PublicRedirectedDocumentReference /// document data. /// /// If no document exists yet, the update will fail. - Future update({ - String value, - FieldValue valueFieldValue, - }); + Future update({String value, FieldValue valueFieldValue}); /// Updates fields in the current document using the transaction API. /// @@ -1339,8 +1353,12 @@ abstract class PublicRedirectedDocumentReference }); } -class _$PublicRedirectedDocumentReference extends FirestoreDocumentReference< - PublicRedirected, PublicRedirectedDocumentSnapshot> +class _$PublicRedirectedDocumentReference + extends + FirestoreDocumentReference< + PublicRedirected, + PublicRedirectedDocumentSnapshot + > implements PublicRedirectedDocumentReference { _$PublicRedirectedDocumentReference(this.reference); @@ -1364,7 +1382,8 @@ class _$PublicRedirectedDocumentReference extends FirestoreDocumentReference< @override Future transactionGet( - Transaction transaction) { + Transaction transaction, + ) { return transaction.get(reference).then(PublicRedirectedDocumentSnapshot._); } @@ -1434,8 +1453,9 @@ class _$PublicRedirectedDocumentReference extends FirestoreDocumentReference< ); final json = { if (value != _sentinel) - _$PublicRedirected2FieldMap['value']!: - _$PublicRedirected2PerFieldToJson.value(value as String), + _$PublicRedirected2FieldMap['value']!: _$PublicRedirected2PerFieldToJson + .value(value as String), + if (valueFieldValue != null) _$PublicRedirected2FieldMap['value']!: valueFieldValue, }; @@ -1454,8 +1474,9 @@ class _$PublicRedirectedDocumentReference extends FirestoreDocumentReference< ); final json = { if (value != _sentinel) - _$PublicRedirected2FieldMap['value']!: - _$PublicRedirected2PerFieldToJson.value(value as String), + _$PublicRedirected2FieldMap['value']!: _$PublicRedirected2PerFieldToJson + .value(value as String), + if (valueFieldValue != null) _$PublicRedirected2FieldMap['value']!: valueFieldValue, }; @@ -1474,8 +1495,9 @@ class _$PublicRedirectedDocumentReference extends FirestoreDocumentReference< ); final json = { if (value != _sentinel) - _$PublicRedirected2FieldMap['value']!: - _$PublicRedirected2PerFieldToJson.value(value as String), + _$PublicRedirected2FieldMap['value']!: _$PublicRedirected2PerFieldToJson + .value(value as String), + if (valueFieldValue != null) _$PublicRedirected2FieldMap['value']!: valueFieldValue, }; @@ -1625,17 +1647,17 @@ class _$PublicRedirectedQuery required Query $referenceWithoutCursor, $QueryCursor $queryCursor = const $QueryCursor(), }) : super( - $referenceWithoutCursor: $referenceWithoutCursor, - $queryCursor: $queryCursor, - ); + $referenceWithoutCursor: $referenceWithoutCursor, + $queryCursor: $queryCursor, + ); final CollectionReference _collection; @override Stream snapshots([SnapshotOptions? options]) { - return reference - .snapshots() - .map(PublicRedirectedQuerySnapshot._fromQuerySnapshot); + return reference.snapshots().map( + PublicRedirectedQuerySnapshot._fromQuerySnapshot, + ); } @override @@ -1692,7 +1714,8 @@ class _$PublicRedirectedQuery arrayContainsAny: arrayContainsAny, whereIn: whereIn, whereNotIn: whereNotIn, - isNull: isNull ?? + isNull: + isNull ?? (isEqualTo == null ? false : null) ?? (isNotEqualTo == null ? true : null), ), @@ -1724,7 +1747,8 @@ class _$PublicRedirectedQuery isGreaterThanOrEqualTo: isGreaterThanOrEqualTo, whereIn: whereIn, whereNotIn: whereNotIn, - isNull: isNull ?? + isNull: + isNull ?? (isEqualTo == null ? false : null) ?? (isNotEqualTo == null ? true : null), ), @@ -1758,21 +1782,26 @@ class _$PublicRedirectedQuery ? _$PublicRedirected2PerFieldToJson.value(isLessThan as String) : null, isLessThanOrEqualTo: isLessThanOrEqualTo != null - ? _$PublicRedirected2PerFieldToJson - .value(isLessThanOrEqualTo as String) + ? _$PublicRedirected2PerFieldToJson.value( + isLessThanOrEqualTo as String, + ) : null, isGreaterThan: isGreaterThan != null ? _$PublicRedirected2PerFieldToJson.value(isGreaterThan as String) : null, isGreaterThanOrEqualTo: isGreaterThanOrEqualTo != null - ? _$PublicRedirected2PerFieldToJson - .value(isGreaterThanOrEqualTo as String) + ? _$PublicRedirected2PerFieldToJson.value( + isGreaterThanOrEqualTo as String, + ) : null, - whereIn: - whereIn?.map((e) => _$PublicRedirected2PerFieldToJson.value(e)), - whereNotIn: - whereNotIn?.map((e) => _$PublicRedirected2PerFieldToJson.value(e)), - isNull: isNull ?? + whereIn: whereIn?.map( + (e) => _$PublicRedirected2PerFieldToJson.value(e), + ), + whereNotIn: whereNotIn?.map( + (e) => _$PublicRedirected2PerFieldToJson.value(e), + ), + isNull: + isNull ?? (isEqualTo == null ? false : null) ?? (isNotEqualTo == null ? true : null), ), @@ -1793,8 +1822,10 @@ class _$PublicRedirectedQuery PublicRedirectedDocumentSnapshot? endBeforeDocument, PublicRedirectedDocumentSnapshot? startAfterDocument, }) { - final query = - $referenceWithoutCursor.orderBy(fieldPath, descending: descending); + final query = $referenceWithoutCursor.orderBy( + fieldPath, + descending: descending, + ); var queryCursor = $queryCursor; if (startAtDocument != null) { @@ -1866,8 +1897,10 @@ class _$PublicRedirectedQuery PublicRedirectedDocumentSnapshot? endBeforeDocument, PublicRedirectedDocumentSnapshot? startAfterDocument, }) { - final query = $referenceWithoutCursor.orderBy(FieldPath.documentId, - descending: descending); + final query = $referenceWithoutCursor.orderBy( + FieldPath.documentId, + descending: descending, + ); var queryCursor = $queryCursor; if (startAtDocument != null) { @@ -1939,8 +1972,10 @@ class _$PublicRedirectedQuery PublicRedirectedDocumentSnapshot? endBeforeDocument, PublicRedirectedDocumentSnapshot? startAfterDocument, }) { - final query = $referenceWithoutCursor - .orderBy(_$PublicRedirected2FieldMap['value']!, descending: descending); + final query = $referenceWithoutCursor.orderBy( + _$PublicRedirected2FieldMap['value']!, + descending: descending, + ); var queryCursor = $queryCursor; if (startAtDocument != null) { @@ -1972,7 +2007,7 @@ class _$PublicRedirectedQuery queryCursor = queryCursor.copyWith( startAt: [ ...queryCursor.startAt, - _$PublicRedirected2PerFieldToJson.value(startAt as String) + _$PublicRedirected2PerFieldToJson.value(startAt as String), ], startAtDocumentSnapshot: null, ); @@ -1981,7 +2016,7 @@ class _$PublicRedirectedQuery queryCursor = queryCursor.copyWith( startAfter: [ ...queryCursor.startAfter, - _$PublicRedirected2PerFieldToJson.value(startAfter as String) + _$PublicRedirected2PerFieldToJson.value(startAfter as String), ], startAfterDocumentSnapshot: null, ); @@ -1990,7 +2025,7 @@ class _$PublicRedirectedQuery queryCursor = queryCursor.copyWith( endAt: [ ...queryCursor.endAt, - _$PublicRedirected2PerFieldToJson.value(endAt as String) + _$PublicRedirected2PerFieldToJson.value(endAt as String), ], endAtDocumentSnapshot: null, ); @@ -1999,7 +2034,7 @@ class _$PublicRedirectedQuery queryCursor = queryCursor.copyWith( endBefore: [ ...queryCursor.endBefore, - _$PublicRedirected2PerFieldToJson.value(endBefore as String) + _$PublicRedirected2PerFieldToJson.value(endBefore as String), ], endBeforeDocumentSnapshot: null, ); @@ -2032,48 +2067,40 @@ class PublicRedirectedDocumentSnapshot @override PublicRedirectedDocumentReference get reference { - return PublicRedirectedDocumentReference( - snapshot.reference, - ); + return PublicRedirectedDocumentReference(snapshot.reference); } @override final PublicRedirected? data; } -class PublicRedirectedQuerySnapshot extends FirestoreQuerySnapshot< - PublicRedirected, PublicRedirectedQueryDocumentSnapshot> { - PublicRedirectedQuerySnapshot._( - this.snapshot, - this.docs, - this.docChanges, - ); +class PublicRedirectedQuerySnapshot + extends + FirestoreQuerySnapshot< + PublicRedirected, + PublicRedirectedQueryDocumentSnapshot + > { + PublicRedirectedQuerySnapshot._(this.snapshot, this.docs, this.docChanges); factory PublicRedirectedQuerySnapshot._fromQuerySnapshot( QuerySnapshot snapshot, ) { - final docs = - snapshot.docs.map(PublicRedirectedQueryDocumentSnapshot._).toList(); + final docs = snapshot.docs + .map(PublicRedirectedQueryDocumentSnapshot._) + .toList(); final docChanges = snapshot.docChanges.map((change) { - return _decodeDocumentChange( - change, - PublicRedirectedDocumentSnapshot._, - ); + return _decodeDocumentChange(change, PublicRedirectedDocumentSnapshot._); }).toList(); - return PublicRedirectedQuerySnapshot._( - snapshot, - docs, - docChanges, - ); + return PublicRedirectedQuerySnapshot._(snapshot, docs, docChanges); } static FirestoreDocumentChange - _decodeDocumentChange( + _decodeDocumentChange( DocumentChange docChange, PublicRedirectedDocumentSnapshot Function(DocumentSnapshot doc) - decodeDoc, + decodeDoc, ) { return FirestoreDocumentChange( type: docChange.type, @@ -2090,14 +2117,14 @@ class PublicRedirectedQuerySnapshot extends FirestoreQuerySnapshot< @override final List> - docChanges; + docChanges; } class PublicRedirectedQueryDocumentSnapshot extends FirestoreQueryDocumentSnapshot implements PublicRedirectedDocumentSnapshot { PublicRedirectedQueryDocumentSnapshot._(this.snapshot) - : data = snapshot.data(); + : data = snapshot.data(); @override final QueryDocumentSnapshot snapshot; @@ -2116,9 +2143,9 @@ class PublicRedirectedQueryDocumentSnapshot // ************************************************************************** _Person _$PersonFromJson(Map json) => _Person( - firstName: json['first_name'] as String, - lastName: json['LAST_NAME'] as String, - ); + firstName: json['first_name'] as String, + lastName: json['LAST_NAME'] as String, +); const _$PersonFieldMap = { 'firstName': 'first_name', @@ -2134,18 +2161,14 @@ abstract class _$PersonPerFieldToJson { } Map _$PersonToJson(_Person instance) => { - 'first_name': instance.firstName, - 'LAST_NAME': instance.lastName, - }; + 'first_name': instance.firstName, + 'LAST_NAME': instance.lastName, +}; PublicRedirected2 _$PublicRedirected2FromJson(Map json) => - PublicRedirected2( - value: json['value'] as String, - ); + PublicRedirected2(value: json['value'] as String); -const _$PublicRedirected2FieldMap = { - 'value': 'value', -}; +const _$PublicRedirected2FieldMap = {'value': 'value'}; // ignore: unused_element abstract class _$PublicRedirected2PerFieldToJson { @@ -2154,6 +2177,4 @@ abstract class _$PublicRedirected2PerFieldToJson { } Map _$PublicRedirected2ToJson(PublicRedirected2 instance) => - { - 'value': instance.value, - }; + {'value': instance.value}; diff --git a/packages/cloud_firestore_odm/example/lib/integration/named_query.g.dart b/packages/cloud_firestore_odm/example/lib/integration/named_query.g.dart index c5dee3e..1a9d8c0 100644 --- a/packages/cloud_firestore_odm/example/lib/integration/named_query.g.dart +++ b/packages/cloud_firestore_odm/example/lib/integration/named_query.g.dart @@ -19,23 +19,6 @@ class _Sentinel { const _sentinel = _Sentinel(); -/// Adds [namedBundleTest4Get] to [FirebaseFirestore]. -extension NamedBundleTest4Extrension on FirebaseFirestore { - /// Performs [FirebaseFirestore.namedQueryGet] and decode the result into - /// a [Conflict] snashot. - Future namedBundleTest4Get({ - GetOptions options = const GetOptions(), - }) async { - final snapshot = await namedQueryWithConverterGet( - r'named-bundle-test-4', - fromFirestore: ConflictCollectionReference.fromFirestore, - toFirestore: ConflictCollectionReference.toFirestore, - options: options, - ); - return ConflictQuerySnapshot._fromQuerySnapshot(snapshot); - } -} - /// A collection reference object can be used for adding documents, /// getting document references, and querying for documents /// (using the methods inherited from Query). @@ -43,9 +26,8 @@ abstract class ConflictCollectionReference implements ConflictQuery, FirestoreCollectionReference { - factory ConflictCollectionReference([ - FirebaseFirestore? firestore, - ]) = _$ConflictCollectionReference; + factory ConflictCollectionReference([FirebaseFirestore? firestore]) = + _$ConflictCollectionReference; static Conflict fromFirestore( DocumentSnapshot> snapshot, @@ -54,10 +36,7 @@ abstract class ConflictCollectionReference return _$ConflictFromJson(snapshot.data()!); } - static Map toFirestore( - Conflict value, - SetOptions? options, - ) { + static Map toFirestore(Conflict value, SetOptions? options) { return _$ConflictToJson(value); } @@ -87,9 +66,8 @@ class _$ConflictCollectionReference extends _$ConflictQuery ); } - _$ConflictCollectionReference._( - CollectionReference reference, - ) : super(reference, $referenceWithoutCursor: reference); + _$ConflictCollectionReference._(CollectionReference reference) + : super(reference, $referenceWithoutCursor: reference); String get path => reference.path; @@ -103,9 +81,7 @@ class _$ConflictCollectionReference extends _$ConflictQuery id == null || id.split('/').length == 1, 'The document ID cannot be from a different collection', ); - return ConflictDocumentReference( - reference.doc(id), - ); + return ConflictDocumentReference(reference.doc(id)); } @override @@ -191,10 +167,7 @@ abstract class ConflictDocumentReference /// document data. /// /// If no document exists yet, the update will fail. - Future update({ - num number, - FieldValue numberFieldValue, - }); + Future update({num number, FieldValue numberFieldValue}); /// Updates fields in the current document using the transaction API. /// @@ -208,11 +181,7 @@ abstract class ConflictDocumentReference /// Updates fields in the current document using the batch API. /// /// The update will fail if applied to a document that does not exist. - void batchUpdate( - WriteBatch batch, { - num number, - FieldValue numberFieldValue, - }); + void batchUpdate(WriteBatch batch, {num number, FieldValue numberFieldValue}); } class _$ConflictDocumentReference @@ -309,8 +278,10 @@ class _$ConflictDocumentReference ); final json = { if (number != _sentinel) - _$ConflictFieldMap['number']!: - _$ConflictPerFieldToJson.number(number as num), + _$ConflictFieldMap['number']!: _$ConflictPerFieldToJson.number( + number as num, + ), + if (numberFieldValue != null) _$ConflictFieldMap['number']!: numberFieldValue, }; @@ -329,8 +300,10 @@ class _$ConflictDocumentReference ); final json = { if (number != _sentinel) - _$ConflictFieldMap['number']!: - _$ConflictPerFieldToJson.number(number as num), + _$ConflictFieldMap['number']!: _$ConflictPerFieldToJson.number( + number as num, + ), + if (numberFieldValue != null) _$ConflictFieldMap['number']!: numberFieldValue, }; @@ -349,8 +322,10 @@ class _$ConflictDocumentReference ); final json = { if (number != _sentinel) - _$ConflictFieldMap['number']!: - _$ConflictPerFieldToJson.number(number as num), + _$ConflictFieldMap['number']!: _$ConflictPerFieldToJson.number( + number as num, + ), + if (numberFieldValue != null) _$ConflictFieldMap['number']!: numberFieldValue, }; @@ -499,9 +474,9 @@ class _$ConflictQuery extends QueryReference required Query $referenceWithoutCursor, $QueryCursor $queryCursor = const $QueryCursor(), }) : super( - $referenceWithoutCursor: $referenceWithoutCursor, - $queryCursor: $queryCursor, - ); + $referenceWithoutCursor: $referenceWithoutCursor, + $queryCursor: $queryCursor, + ); final CollectionReference _collection; @@ -564,7 +539,8 @@ class _$ConflictQuery extends QueryReference arrayContainsAny: arrayContainsAny, whereIn: whereIn, whereNotIn: whereNotIn, - isNull: isNull ?? + isNull: + isNull ?? (isEqualTo == null ? false : null) ?? (isNotEqualTo == null ? true : null), ), @@ -596,7 +572,8 @@ class _$ConflictQuery extends QueryReference isGreaterThanOrEqualTo: isGreaterThanOrEqualTo, whereIn: whereIn, whereNotIn: whereNotIn, - isNull: isNull ?? + isNull: + isNull ?? (isEqualTo == null ? false : null) ?? (isNotEqualTo == null ? true : null), ), @@ -640,7 +617,8 @@ class _$ConflictQuery extends QueryReference : null, whereIn: whereIn?.map((e) => _$ConflictPerFieldToJson.number(e)), whereNotIn: whereNotIn?.map((e) => _$ConflictPerFieldToJson.number(e)), - isNull: isNull ?? + isNull: + isNull ?? (isEqualTo == null ? false : null) ?? (isNotEqualTo == null ? true : null), ), @@ -661,8 +639,10 @@ class _$ConflictQuery extends QueryReference ConflictDocumentSnapshot? endBeforeDocument, ConflictDocumentSnapshot? startAfterDocument, }) { - final query = - $referenceWithoutCursor.orderBy(fieldPath, descending: descending); + final query = $referenceWithoutCursor.orderBy( + fieldPath, + descending: descending, + ); var queryCursor = $queryCursor; if (startAtDocument != null) { @@ -734,8 +714,10 @@ class _$ConflictQuery extends QueryReference ConflictDocumentSnapshot? endBeforeDocument, ConflictDocumentSnapshot? startAfterDocument, }) { - final query = $referenceWithoutCursor.orderBy(FieldPath.documentId, - descending: descending); + final query = $referenceWithoutCursor.orderBy( + FieldPath.documentId, + descending: descending, + ); var queryCursor = $queryCursor; if (startAtDocument != null) { @@ -807,8 +789,10 @@ class _$ConflictQuery extends QueryReference ConflictDocumentSnapshot? endBeforeDocument, ConflictDocumentSnapshot? startAfterDocument, }) { - final query = $referenceWithoutCursor.orderBy(_$ConflictFieldMap['number']!, - descending: descending); + final query = $referenceWithoutCursor.orderBy( + _$ConflictFieldMap['number']!, + descending: descending, + ); var queryCursor = $queryCursor; if (startAtDocument != null) { @@ -840,7 +824,7 @@ class _$ConflictQuery extends QueryReference queryCursor = queryCursor.copyWith( startAt: [ ...queryCursor.startAt, - _$ConflictPerFieldToJson.number(startAt as num) + _$ConflictPerFieldToJson.number(startAt as num), ], startAtDocumentSnapshot: null, ); @@ -849,7 +833,7 @@ class _$ConflictQuery extends QueryReference queryCursor = queryCursor.copyWith( startAfter: [ ...queryCursor.startAfter, - _$ConflictPerFieldToJson.number(startAfter as num) + _$ConflictPerFieldToJson.number(startAfter as num), ], startAfterDocumentSnapshot: null, ); @@ -858,7 +842,7 @@ class _$ConflictQuery extends QueryReference queryCursor = queryCursor.copyWith( endAt: [ ...queryCursor.endAt, - _$ConflictPerFieldToJson.number(endAt as num) + _$ConflictPerFieldToJson.number(endAt as num), ], endAtDocumentSnapshot: null, ); @@ -867,7 +851,7 @@ class _$ConflictQuery extends QueryReference queryCursor = queryCursor.copyWith( endBefore: [ ...queryCursor.endBefore, - _$ConflictPerFieldToJson.number(endBefore as num) + _$ConflictPerFieldToJson.number(endBefore as num), ], endBeforeDocumentSnapshot: null, ); @@ -899,9 +883,7 @@ class ConflictDocumentSnapshot extends FirestoreDocumentSnapshot { @override ConflictDocumentReference get reference { - return ConflictDocumentReference( - snapshot.reference, - ); + return ConflictDocumentReference(snapshot.reference); } @override @@ -910,11 +892,7 @@ class ConflictDocumentSnapshot extends FirestoreDocumentSnapshot { class ConflictQuerySnapshot extends FirestoreQuerySnapshot { - ConflictQuerySnapshot._( - this.snapshot, - this.docs, - this.docChanges, - ); + ConflictQuerySnapshot._(this.snapshot, this.docs, this.docChanges); factory ConflictQuerySnapshot._fromQuerySnapshot( QuerySnapshot snapshot, @@ -922,21 +900,14 @@ class ConflictQuerySnapshot final docs = snapshot.docs.map(ConflictQueryDocumentSnapshot._).toList(); final docChanges = snapshot.docChanges.map((change) { - return _decodeDocumentChange( - change, - ConflictDocumentSnapshot._, - ); + return _decodeDocumentChange(change, ConflictDocumentSnapshot._); }).toList(); - return ConflictQuerySnapshot._( - snapshot, - docs, - docChanges, - ); + return ConflictQuerySnapshot._(snapshot, docs, docChanges); } static FirestoreDocumentChange - _decodeDocumentChange( + _decodeDocumentChange( DocumentChange docChange, ConflictDocumentSnapshot Function(DocumentSnapshot doc) decodeDoc, ) { @@ -978,13 +949,10 @@ class ConflictQueryDocumentSnapshot // JsonSerializableGenerator // ************************************************************************** -Conflict _$ConflictFromJson(Map json) => Conflict( - json['number'] as num, - ); +Conflict _$ConflictFromJson(Map json) => + Conflict(json['number'] as num); -const _$ConflictFieldMap = { - 'number': 'number', -}; +const _$ConflictFieldMap = {'number': 'number'}; // ignore: unused_element abstract class _$ConflictPerFieldToJson { @@ -993,5 +961,5 @@ abstract class _$ConflictPerFieldToJson { } Map _$ConflictToJson(Conflict instance) => { - 'number': instance.number, - }; + 'number': instance.number, +}; diff --git a/packages/cloud_firestore_odm/example/lib/integration/query.g.dart b/packages/cloud_firestore_odm/example/lib/integration/query.g.dart index df80fe6..6fee6c7 100644 --- a/packages/cloud_firestore_odm/example/lib/integration/query.g.dart +++ b/packages/cloud_firestore_odm/example/lib/integration/query.g.dart @@ -25,11 +25,12 @@ const _sentinel = _Sentinel(); abstract class DurationQueryCollectionReference implements DurationQueryQuery, - FirestoreCollectionReference { - factory DurationQueryCollectionReference([ - FirebaseFirestore? firestore, - ]) = _$DurationQueryCollectionReference; + FirestoreCollectionReference< + DurationQuery, + DurationQueryQuerySnapshot + > { + factory DurationQueryCollectionReference([FirebaseFirestore? firestore]) = + _$DurationQueryCollectionReference; static DurationQuery fromFirestore( DocumentSnapshot> snapshot, @@ -62,7 +63,9 @@ class _$DurationQueryCollectionReference extends _$DurationQueryQuery firestore ??= FirebaseFirestore.instance; return _$DurationQueryCollectionReference._( - firestore.collection('firestore-example-app/42/duration').withConverter( + firestore + .collection('firestore-example-app/42/duration') + .withConverter( fromFirestore: DurationQueryCollectionReference.fromFirestore, toFirestore: DurationQueryCollectionReference.toFirestore, ), @@ -85,9 +88,7 @@ class _$DurationQueryCollectionReference extends _$DurationQueryQuery id == null || id.split('/').length == 1, 'The document ID cannot be from a different collection', ); - return DurationQueryDocumentReference( - reference.doc(id), - ); + return DurationQueryDocumentReference(reference.doc(id)); } @override @@ -109,11 +110,14 @@ class _$DurationQueryCollectionReference extends _$DurationQueryQuery } abstract class DurationQueryDocumentReference - extends FirestoreDocumentReference { + extends + FirestoreDocumentReference< + DurationQuery, + DurationQueryDocumentSnapshot + > { factory DurationQueryDocumentReference( - DocumentReference reference) = - _$DurationQueryDocumentReference; + DocumentReference reference, + ) = _$DurationQueryDocumentReference; DocumentReference get reference; @@ -177,10 +181,7 @@ abstract class DurationQueryDocumentReference /// document data. /// /// If no document exists yet, the update will fail. - Future update({ - Duration duration, - FieldValue durationFieldValue, - }); + Future update({Duration duration, FieldValue durationFieldValue}); /// Updates fields in the current document using the transaction API. /// @@ -201,9 +202,10 @@ abstract class DurationQueryDocumentReference }); } -class _$DurationQueryDocumentReference extends FirestoreDocumentReference< - DurationQuery, - DurationQueryDocumentSnapshot> implements DurationQueryDocumentReference { +class _$DurationQueryDocumentReference + extends + FirestoreDocumentReference + implements DurationQueryDocumentReference { _$DurationQueryDocumentReference(this.reference); @override @@ -226,7 +228,8 @@ class _$DurationQueryDocumentReference extends FirestoreDocumentReference< @override Future transactionGet( - Transaction transaction) { + Transaction transaction, + ) { return transaction.get(reference).then(DurationQueryDocumentSnapshot._); } @@ -296,8 +299,9 @@ class _$DurationQueryDocumentReference extends FirestoreDocumentReference< ); final json = { if (duration != _sentinel) - _$DurationQueryFieldMap['duration']!: - _$DurationQueryPerFieldToJson.duration(duration as Duration), + _$DurationQueryFieldMap['duration']!: _$DurationQueryPerFieldToJson + .duration(duration as Duration), + if (durationFieldValue != null) _$DurationQueryFieldMap['duration']!: durationFieldValue, }; @@ -316,8 +320,9 @@ class _$DurationQueryDocumentReference extends FirestoreDocumentReference< ); final json = { if (duration != _sentinel) - _$DurationQueryFieldMap['duration']!: - _$DurationQueryPerFieldToJson.duration(duration as Duration), + _$DurationQueryFieldMap['duration']!: _$DurationQueryPerFieldToJson + .duration(duration as Duration), + if (durationFieldValue != null) _$DurationQueryFieldMap['duration']!: durationFieldValue, }; @@ -336,8 +341,9 @@ class _$DurationQueryDocumentReference extends FirestoreDocumentReference< ); final json = { if (duration != _sentinel) - _$DurationQueryFieldMap['duration']!: - _$DurationQueryPerFieldToJson.duration(duration as Duration), + _$DurationQueryFieldMap['duration']!: _$DurationQueryPerFieldToJson + .duration(duration as Duration), + if (durationFieldValue != null) _$DurationQueryFieldMap['duration']!: durationFieldValue, }; @@ -487,17 +493,17 @@ class _$DurationQueryQuery required Query $referenceWithoutCursor, $QueryCursor $queryCursor = const $QueryCursor(), }) : super( - $referenceWithoutCursor: $referenceWithoutCursor, - $queryCursor: $queryCursor, - ); + $referenceWithoutCursor: $referenceWithoutCursor, + $queryCursor: $queryCursor, + ); final CollectionReference _collection; @override Stream snapshots([SnapshotOptions? options]) { - return reference - .snapshots() - .map(DurationQueryQuerySnapshot._fromQuerySnapshot); + return reference.snapshots().map( + DurationQueryQuerySnapshot._fromQuerySnapshot, + ); } @override @@ -554,7 +560,8 @@ class _$DurationQueryQuery arrayContainsAny: arrayContainsAny, whereIn: whereIn, whereNotIn: whereNotIn, - isNull: isNull ?? + isNull: + isNull ?? (isEqualTo == null ? false : null) ?? (isNotEqualTo == null ? true : null), ), @@ -586,7 +593,8 @@ class _$DurationQueryQuery isGreaterThanOrEqualTo: isGreaterThanOrEqualTo, whereIn: whereIn, whereNotIn: whereNotIn, - isNull: isNull ?? + isNull: + isNull ?? (isEqualTo == null ? false : null) ?? (isNotEqualTo == null ? true : null), ), @@ -620,20 +628,24 @@ class _$DurationQueryQuery ? _$DurationQueryPerFieldToJson.duration(isLessThan as Duration) : null, isLessThanOrEqualTo: isLessThanOrEqualTo != null - ? _$DurationQueryPerFieldToJson - .duration(isLessThanOrEqualTo as Duration) + ? _$DurationQueryPerFieldToJson.duration( + isLessThanOrEqualTo as Duration, + ) : null, isGreaterThan: isGreaterThan != null ? _$DurationQueryPerFieldToJson.duration(isGreaterThan as Duration) : null, isGreaterThanOrEqualTo: isGreaterThanOrEqualTo != null - ? _$DurationQueryPerFieldToJson - .duration(isGreaterThanOrEqualTo as Duration) + ? _$DurationQueryPerFieldToJson.duration( + isGreaterThanOrEqualTo as Duration, + ) : null, whereIn: whereIn?.map((e) => _$DurationQueryPerFieldToJson.duration(e)), - whereNotIn: - whereNotIn?.map((e) => _$DurationQueryPerFieldToJson.duration(e)), - isNull: isNull ?? + whereNotIn: whereNotIn?.map( + (e) => _$DurationQueryPerFieldToJson.duration(e), + ), + isNull: + isNull ?? (isEqualTo == null ? false : null) ?? (isNotEqualTo == null ? true : null), ), @@ -654,8 +666,10 @@ class _$DurationQueryQuery DurationQueryDocumentSnapshot? endBeforeDocument, DurationQueryDocumentSnapshot? startAfterDocument, }) { - final query = - $referenceWithoutCursor.orderBy(fieldPath, descending: descending); + final query = $referenceWithoutCursor.orderBy( + fieldPath, + descending: descending, + ); var queryCursor = $queryCursor; if (startAtDocument != null) { @@ -727,8 +741,10 @@ class _$DurationQueryQuery DurationQueryDocumentSnapshot? endBeforeDocument, DurationQueryDocumentSnapshot? startAfterDocument, }) { - final query = $referenceWithoutCursor.orderBy(FieldPath.documentId, - descending: descending); + final query = $referenceWithoutCursor.orderBy( + FieldPath.documentId, + descending: descending, + ); var queryCursor = $queryCursor; if (startAtDocument != null) { @@ -800,8 +816,10 @@ class _$DurationQueryQuery DurationQueryDocumentSnapshot? endBeforeDocument, DurationQueryDocumentSnapshot? startAfterDocument, }) { - final query = $referenceWithoutCursor - .orderBy(_$DurationQueryFieldMap['duration']!, descending: descending); + final query = $referenceWithoutCursor.orderBy( + _$DurationQueryFieldMap['duration']!, + descending: descending, + ); var queryCursor = $queryCursor; if (startAtDocument != null) { @@ -833,7 +851,7 @@ class _$DurationQueryQuery queryCursor = queryCursor.copyWith( startAt: [ ...queryCursor.startAt, - _$DurationQueryPerFieldToJson.duration(startAt as Duration) + _$DurationQueryPerFieldToJson.duration(startAt as Duration), ], startAtDocumentSnapshot: null, ); @@ -842,7 +860,7 @@ class _$DurationQueryQuery queryCursor = queryCursor.copyWith( startAfter: [ ...queryCursor.startAfter, - _$DurationQueryPerFieldToJson.duration(startAfter as Duration) + _$DurationQueryPerFieldToJson.duration(startAfter as Duration), ], startAfterDocumentSnapshot: null, ); @@ -851,7 +869,7 @@ class _$DurationQueryQuery queryCursor = queryCursor.copyWith( endAt: [ ...queryCursor.endAt, - _$DurationQueryPerFieldToJson.duration(endAt as Duration) + _$DurationQueryPerFieldToJson.duration(endAt as Duration), ], endAtDocumentSnapshot: null, ); @@ -860,7 +878,7 @@ class _$DurationQueryQuery queryCursor = queryCursor.copyWith( endBefore: [ ...queryCursor.endBefore, - _$DurationQueryPerFieldToJson.duration(endBefore as Duration) + _$DurationQueryPerFieldToJson.duration(endBefore as Duration), ], endBeforeDocumentSnapshot: null, ); @@ -893,45 +911,37 @@ class DurationQueryDocumentSnapshot @override DurationQueryDocumentReference get reference { - return DurationQueryDocumentReference( - snapshot.reference, - ); + return DurationQueryDocumentReference(snapshot.reference); } @override final DurationQuery? data; } -class DurationQueryQuerySnapshot extends FirestoreQuerySnapshot { - DurationQueryQuerySnapshot._( - this.snapshot, - this.docs, - this.docChanges, - ); +class DurationQueryQuerySnapshot + extends + FirestoreQuerySnapshot< + DurationQuery, + DurationQueryQueryDocumentSnapshot + > { + DurationQueryQuerySnapshot._(this.snapshot, this.docs, this.docChanges); factory DurationQueryQuerySnapshot._fromQuerySnapshot( QuerySnapshot snapshot, ) { - final docs = - snapshot.docs.map(DurationQueryQueryDocumentSnapshot._).toList(); + final docs = snapshot.docs + .map(DurationQueryQueryDocumentSnapshot._) + .toList(); final docChanges = snapshot.docChanges.map((change) { - return _decodeDocumentChange( - change, - DurationQueryDocumentSnapshot._, - ); + return _decodeDocumentChange(change, DurationQueryDocumentSnapshot._); }).toList(); - return DurationQueryQuerySnapshot._( - snapshot, - docs, - docChanges, - ); + return DurationQueryQuerySnapshot._(snapshot, docs, docChanges); } static FirestoreDocumentChange - _decodeDocumentChange( + _decodeDocumentChange( DocumentChange docChange, DurationQueryDocumentSnapshot Function(DocumentSnapshot doc) decodeDoc, ) { @@ -975,11 +985,12 @@ class DurationQueryQueryDocumentSnapshot abstract class DateTimeQueryCollectionReference implements DateTimeQueryQuery, - FirestoreCollectionReference { - factory DateTimeQueryCollectionReference([ - FirebaseFirestore? firestore, - ]) = _$DateTimeQueryCollectionReference; + FirestoreCollectionReference< + DateTimeQuery, + DateTimeQueryQuerySnapshot + > { + factory DateTimeQueryCollectionReference([FirebaseFirestore? firestore]) = + _$DateTimeQueryCollectionReference; static DateTimeQuery fromFirestore( DocumentSnapshot> snapshot, @@ -1012,7 +1023,9 @@ class _$DateTimeQueryCollectionReference extends _$DateTimeQueryQuery firestore ??= FirebaseFirestore.instance; return _$DateTimeQueryCollectionReference._( - firestore.collection('firestore-example-app/42/date-time').withConverter( + firestore + .collection('firestore-example-app/42/date-time') + .withConverter( fromFirestore: DateTimeQueryCollectionReference.fromFirestore, toFirestore: DateTimeQueryCollectionReference.toFirestore, ), @@ -1035,9 +1048,7 @@ class _$DateTimeQueryCollectionReference extends _$DateTimeQueryQuery id == null || id.split('/').length == 1, 'The document ID cannot be from a different collection', ); - return DateTimeQueryDocumentReference( - reference.doc(id), - ); + return DateTimeQueryDocumentReference(reference.doc(id)); } @override @@ -1059,11 +1070,14 @@ class _$DateTimeQueryCollectionReference extends _$DateTimeQueryQuery } abstract class DateTimeQueryDocumentReference - extends FirestoreDocumentReference { + extends + FirestoreDocumentReference< + DateTimeQuery, + DateTimeQueryDocumentSnapshot + > { factory DateTimeQueryDocumentReference( - DocumentReference reference) = - _$DateTimeQueryDocumentReference; + DocumentReference reference, + ) = _$DateTimeQueryDocumentReference; DocumentReference get reference; @@ -1127,10 +1141,7 @@ abstract class DateTimeQueryDocumentReference /// document data. /// /// If no document exists yet, the update will fail. - Future update({ - DateTime time, - FieldValue timeFieldValue, - }); + Future update({DateTime time, FieldValue timeFieldValue}); /// Updates fields in the current document using the transaction API. /// @@ -1151,9 +1162,10 @@ abstract class DateTimeQueryDocumentReference }); } -class _$DateTimeQueryDocumentReference extends FirestoreDocumentReference< - DateTimeQuery, - DateTimeQueryDocumentSnapshot> implements DateTimeQueryDocumentReference { +class _$DateTimeQueryDocumentReference + extends + FirestoreDocumentReference + implements DateTimeQueryDocumentReference { _$DateTimeQueryDocumentReference(this.reference); @override @@ -1176,7 +1188,8 @@ class _$DateTimeQueryDocumentReference extends FirestoreDocumentReference< @override Future transactionGet( - Transaction transaction) { + Transaction transaction, + ) { return transaction.get(reference).then(DateTimeQueryDocumentSnapshot._); } @@ -1246,8 +1259,10 @@ class _$DateTimeQueryDocumentReference extends FirestoreDocumentReference< ); final json = { if (time != _sentinel) - _$DateTimeQueryFieldMap['time']!: - _$DateTimeQueryPerFieldToJson.time(time as DateTime), + _$DateTimeQueryFieldMap['time']!: _$DateTimeQueryPerFieldToJson.time( + time as DateTime, + ), + if (timeFieldValue != null) _$DateTimeQueryFieldMap['time']!: timeFieldValue, }; @@ -1266,8 +1281,10 @@ class _$DateTimeQueryDocumentReference extends FirestoreDocumentReference< ); final json = { if (time != _sentinel) - _$DateTimeQueryFieldMap['time']!: - _$DateTimeQueryPerFieldToJson.time(time as DateTime), + _$DateTimeQueryFieldMap['time']!: _$DateTimeQueryPerFieldToJson.time( + time as DateTime, + ), + if (timeFieldValue != null) _$DateTimeQueryFieldMap['time']!: timeFieldValue, }; @@ -1286,8 +1303,10 @@ class _$DateTimeQueryDocumentReference extends FirestoreDocumentReference< ); final json = { if (time != _sentinel) - _$DateTimeQueryFieldMap['time']!: - _$DateTimeQueryPerFieldToJson.time(time as DateTime), + _$DateTimeQueryFieldMap['time']!: _$DateTimeQueryPerFieldToJson.time( + time as DateTime, + ), + if (timeFieldValue != null) _$DateTimeQueryFieldMap['time']!: timeFieldValue, }; @@ -1437,17 +1456,17 @@ class _$DateTimeQueryQuery required Query $referenceWithoutCursor, $QueryCursor $queryCursor = const $QueryCursor(), }) : super( - $referenceWithoutCursor: $referenceWithoutCursor, - $queryCursor: $queryCursor, - ); + $referenceWithoutCursor: $referenceWithoutCursor, + $queryCursor: $queryCursor, + ); final CollectionReference _collection; @override Stream snapshots([SnapshotOptions? options]) { - return reference - .snapshots() - .map(DateTimeQueryQuerySnapshot._fromQuerySnapshot); + return reference.snapshots().map( + DateTimeQueryQuerySnapshot._fromQuerySnapshot, + ); } @override @@ -1504,7 +1523,8 @@ class _$DateTimeQueryQuery arrayContainsAny: arrayContainsAny, whereIn: whereIn, whereNotIn: whereNotIn, - isNull: isNull ?? + isNull: + isNull ?? (isEqualTo == null ? false : null) ?? (isNotEqualTo == null ? true : null), ), @@ -1536,7 +1556,8 @@ class _$DateTimeQueryQuery isGreaterThanOrEqualTo: isGreaterThanOrEqualTo, whereIn: whereIn, whereNotIn: whereNotIn, - isNull: isNull ?? + isNull: + isNull ?? (isEqualTo == null ? false : null) ?? (isNotEqualTo == null ? true : null), ), @@ -1570,20 +1591,24 @@ class _$DateTimeQueryQuery ? _$DateTimeQueryPerFieldToJson.time(isLessThan as DateTime) : null, isLessThanOrEqualTo: isLessThanOrEqualTo != null - ? _$DateTimeQueryPerFieldToJson - .time(isLessThanOrEqualTo as DateTime) + ? _$DateTimeQueryPerFieldToJson.time( + isLessThanOrEqualTo as DateTime, + ) : null, isGreaterThan: isGreaterThan != null ? _$DateTimeQueryPerFieldToJson.time(isGreaterThan as DateTime) : null, isGreaterThanOrEqualTo: isGreaterThanOrEqualTo != null - ? _$DateTimeQueryPerFieldToJson - .time(isGreaterThanOrEqualTo as DateTime) + ? _$DateTimeQueryPerFieldToJson.time( + isGreaterThanOrEqualTo as DateTime, + ) : null, whereIn: whereIn?.map((e) => _$DateTimeQueryPerFieldToJson.time(e)), - whereNotIn: - whereNotIn?.map((e) => _$DateTimeQueryPerFieldToJson.time(e)), - isNull: isNull ?? + whereNotIn: whereNotIn?.map( + (e) => _$DateTimeQueryPerFieldToJson.time(e), + ), + isNull: + isNull ?? (isEqualTo == null ? false : null) ?? (isNotEqualTo == null ? true : null), ), @@ -1604,8 +1629,10 @@ class _$DateTimeQueryQuery DateTimeQueryDocumentSnapshot? endBeforeDocument, DateTimeQueryDocumentSnapshot? startAfterDocument, }) { - final query = - $referenceWithoutCursor.orderBy(fieldPath, descending: descending); + final query = $referenceWithoutCursor.orderBy( + fieldPath, + descending: descending, + ); var queryCursor = $queryCursor; if (startAtDocument != null) { @@ -1677,8 +1704,10 @@ class _$DateTimeQueryQuery DateTimeQueryDocumentSnapshot? endBeforeDocument, DateTimeQueryDocumentSnapshot? startAfterDocument, }) { - final query = $referenceWithoutCursor.orderBy(FieldPath.documentId, - descending: descending); + final query = $referenceWithoutCursor.orderBy( + FieldPath.documentId, + descending: descending, + ); var queryCursor = $queryCursor; if (startAtDocument != null) { @@ -1750,8 +1779,10 @@ class _$DateTimeQueryQuery DateTimeQueryDocumentSnapshot? endBeforeDocument, DateTimeQueryDocumentSnapshot? startAfterDocument, }) { - final query = $referenceWithoutCursor - .orderBy(_$DateTimeQueryFieldMap['time']!, descending: descending); + final query = $referenceWithoutCursor.orderBy( + _$DateTimeQueryFieldMap['time']!, + descending: descending, + ); var queryCursor = $queryCursor; if (startAtDocument != null) { @@ -1783,7 +1814,7 @@ class _$DateTimeQueryQuery queryCursor = queryCursor.copyWith( startAt: [ ...queryCursor.startAt, - _$DateTimeQueryPerFieldToJson.time(startAt as DateTime) + _$DateTimeQueryPerFieldToJson.time(startAt as DateTime), ], startAtDocumentSnapshot: null, ); @@ -1792,7 +1823,7 @@ class _$DateTimeQueryQuery queryCursor = queryCursor.copyWith( startAfter: [ ...queryCursor.startAfter, - _$DateTimeQueryPerFieldToJson.time(startAfter as DateTime) + _$DateTimeQueryPerFieldToJson.time(startAfter as DateTime), ], startAfterDocumentSnapshot: null, ); @@ -1801,7 +1832,7 @@ class _$DateTimeQueryQuery queryCursor = queryCursor.copyWith( endAt: [ ...queryCursor.endAt, - _$DateTimeQueryPerFieldToJson.time(endAt as DateTime) + _$DateTimeQueryPerFieldToJson.time(endAt as DateTime), ], endAtDocumentSnapshot: null, ); @@ -1810,7 +1841,7 @@ class _$DateTimeQueryQuery queryCursor = queryCursor.copyWith( endBefore: [ ...queryCursor.endBefore, - _$DateTimeQueryPerFieldToJson.time(endBefore as DateTime) + _$DateTimeQueryPerFieldToJson.time(endBefore as DateTime), ], endBeforeDocumentSnapshot: null, ); @@ -1843,45 +1874,37 @@ class DateTimeQueryDocumentSnapshot @override DateTimeQueryDocumentReference get reference { - return DateTimeQueryDocumentReference( - snapshot.reference, - ); + return DateTimeQueryDocumentReference(snapshot.reference); } @override final DateTimeQuery? data; } -class DateTimeQueryQuerySnapshot extends FirestoreQuerySnapshot { - DateTimeQueryQuerySnapshot._( - this.snapshot, - this.docs, - this.docChanges, - ); +class DateTimeQueryQuerySnapshot + extends + FirestoreQuerySnapshot< + DateTimeQuery, + DateTimeQueryQueryDocumentSnapshot + > { + DateTimeQueryQuerySnapshot._(this.snapshot, this.docs, this.docChanges); factory DateTimeQueryQuerySnapshot._fromQuerySnapshot( QuerySnapshot snapshot, ) { - final docs = - snapshot.docs.map(DateTimeQueryQueryDocumentSnapshot._).toList(); + final docs = snapshot.docs + .map(DateTimeQueryQueryDocumentSnapshot._) + .toList(); final docChanges = snapshot.docChanges.map((change) { - return _decodeDocumentChange( - change, - DateTimeQueryDocumentSnapshot._, - ); + return _decodeDocumentChange(change, DateTimeQueryDocumentSnapshot._); }).toList(); - return DateTimeQueryQuerySnapshot._( - snapshot, - docs, - docChanges, - ); + return DateTimeQueryQuerySnapshot._(snapshot, docs, docChanges); } static FirestoreDocumentChange - _decodeDocumentChange( + _decodeDocumentChange( DocumentChange docChange, DateTimeQueryDocumentSnapshot Function(DocumentSnapshot doc) decodeDoc, ) { @@ -1925,11 +1948,12 @@ class DateTimeQueryQueryDocumentSnapshot abstract class TimestampQueryCollectionReference implements TimestampQueryQuery, - FirestoreCollectionReference { - factory TimestampQueryCollectionReference([ - FirebaseFirestore? firestore, - ]) = _$TimestampQueryCollectionReference; + FirestoreCollectionReference< + TimestampQuery, + TimestampQueryQuerySnapshot + > { + factory TimestampQueryCollectionReference([FirebaseFirestore? firestore]) = + _$TimestampQueryCollectionReference; static TimestampQuery fromFirestore( DocumentSnapshot> snapshot, @@ -1987,9 +2011,7 @@ class _$TimestampQueryCollectionReference extends _$TimestampQueryQuery id == null || id.split('/').length == 1, 'The document ID cannot be from a different collection', ); - return TimestampQueryDocumentReference( - reference.doc(id), - ); + return TimestampQueryDocumentReference(reference.doc(id)); } @override @@ -2011,11 +2033,14 @@ class _$TimestampQueryCollectionReference extends _$TimestampQueryQuery } abstract class TimestampQueryDocumentReference - extends FirestoreDocumentReference { + extends + FirestoreDocumentReference< + TimestampQuery, + TimestampQueryDocumentSnapshot + > { factory TimestampQueryDocumentReference( - DocumentReference reference) = - _$TimestampQueryDocumentReference; + DocumentReference reference, + ) = _$TimestampQueryDocumentReference; DocumentReference get reference; @@ -2079,10 +2104,7 @@ abstract class TimestampQueryDocumentReference /// document data. /// /// If no document exists yet, the update will fail. - Future update({ - Timestamp time, - FieldValue timeFieldValue, - }); + Future update({Timestamp time, FieldValue timeFieldValue}); /// Updates fields in the current document using the transaction API. /// @@ -2103,9 +2125,13 @@ abstract class TimestampQueryDocumentReference }); } -class _$TimestampQueryDocumentReference extends FirestoreDocumentReference< - TimestampQuery, - TimestampQueryDocumentSnapshot> implements TimestampQueryDocumentReference { +class _$TimestampQueryDocumentReference + extends + FirestoreDocumentReference< + TimestampQuery, + TimestampQueryDocumentSnapshot + > + implements TimestampQueryDocumentReference { _$TimestampQueryDocumentReference(this.reference); @override @@ -2128,7 +2154,8 @@ class _$TimestampQueryDocumentReference extends FirestoreDocumentReference< @override Future transactionGet( - Transaction transaction) { + Transaction transaction, + ) { return transaction.get(reference).then(TimestampQueryDocumentSnapshot._); } @@ -2198,8 +2225,10 @@ class _$TimestampQueryDocumentReference extends FirestoreDocumentReference< ); final json = { if (time != _sentinel) - _$TimestampQueryFieldMap['time']!: - _$TimestampQueryPerFieldToJson.time(time as Timestamp), + _$TimestampQueryFieldMap['time']!: _$TimestampQueryPerFieldToJson.time( + time as Timestamp, + ), + if (timeFieldValue != null) _$TimestampQueryFieldMap['time']!: timeFieldValue, }; @@ -2218,8 +2247,10 @@ class _$TimestampQueryDocumentReference extends FirestoreDocumentReference< ); final json = { if (time != _sentinel) - _$TimestampQueryFieldMap['time']!: - _$TimestampQueryPerFieldToJson.time(time as Timestamp), + _$TimestampQueryFieldMap['time']!: _$TimestampQueryPerFieldToJson.time( + time as Timestamp, + ), + if (timeFieldValue != null) _$TimestampQueryFieldMap['time']!: timeFieldValue, }; @@ -2238,8 +2269,10 @@ class _$TimestampQueryDocumentReference extends FirestoreDocumentReference< ); final json = { if (time != _sentinel) - _$TimestampQueryFieldMap['time']!: - _$TimestampQueryPerFieldToJson.time(time as Timestamp), + _$TimestampQueryFieldMap['time']!: _$TimestampQueryPerFieldToJson.time( + time as Timestamp, + ), + if (timeFieldValue != null) _$TimestampQueryFieldMap['time']!: timeFieldValue, }; @@ -2389,17 +2422,17 @@ class _$TimestampQueryQuery required Query $referenceWithoutCursor, $QueryCursor $queryCursor = const $QueryCursor(), }) : super( - $referenceWithoutCursor: $referenceWithoutCursor, - $queryCursor: $queryCursor, - ); + $referenceWithoutCursor: $referenceWithoutCursor, + $queryCursor: $queryCursor, + ); final CollectionReference _collection; @override Stream snapshots([SnapshotOptions? options]) { - return reference - .snapshots() - .map(TimestampQueryQuerySnapshot._fromQuerySnapshot); + return reference.snapshots().map( + TimestampQueryQuerySnapshot._fromQuerySnapshot, + ); } @override @@ -2456,7 +2489,8 @@ class _$TimestampQueryQuery arrayContainsAny: arrayContainsAny, whereIn: whereIn, whereNotIn: whereNotIn, - isNull: isNull ?? + isNull: + isNull ?? (isEqualTo == null ? false : null) ?? (isNotEqualTo == null ? true : null), ), @@ -2488,7 +2522,8 @@ class _$TimestampQueryQuery isGreaterThanOrEqualTo: isGreaterThanOrEqualTo, whereIn: whereIn, whereNotIn: whereNotIn, - isNull: isNull ?? + isNull: + isNull ?? (isEqualTo == null ? false : null) ?? (isNotEqualTo == null ? true : null), ), @@ -2522,20 +2557,24 @@ class _$TimestampQueryQuery ? _$TimestampQueryPerFieldToJson.time(isLessThan as Timestamp) : null, isLessThanOrEqualTo: isLessThanOrEqualTo != null - ? _$TimestampQueryPerFieldToJson - .time(isLessThanOrEqualTo as Timestamp) + ? _$TimestampQueryPerFieldToJson.time( + isLessThanOrEqualTo as Timestamp, + ) : null, isGreaterThan: isGreaterThan != null ? _$TimestampQueryPerFieldToJson.time(isGreaterThan as Timestamp) : null, isGreaterThanOrEqualTo: isGreaterThanOrEqualTo != null - ? _$TimestampQueryPerFieldToJson - .time(isGreaterThanOrEqualTo as Timestamp) + ? _$TimestampQueryPerFieldToJson.time( + isGreaterThanOrEqualTo as Timestamp, + ) : null, whereIn: whereIn?.map((e) => _$TimestampQueryPerFieldToJson.time(e)), - whereNotIn: - whereNotIn?.map((e) => _$TimestampQueryPerFieldToJson.time(e)), - isNull: isNull ?? + whereNotIn: whereNotIn?.map( + (e) => _$TimestampQueryPerFieldToJson.time(e), + ), + isNull: + isNull ?? (isEqualTo == null ? false : null) ?? (isNotEqualTo == null ? true : null), ), @@ -2556,8 +2595,10 @@ class _$TimestampQueryQuery TimestampQueryDocumentSnapshot? endBeforeDocument, TimestampQueryDocumentSnapshot? startAfterDocument, }) { - final query = - $referenceWithoutCursor.orderBy(fieldPath, descending: descending); + final query = $referenceWithoutCursor.orderBy( + fieldPath, + descending: descending, + ); var queryCursor = $queryCursor; if (startAtDocument != null) { @@ -2629,8 +2670,10 @@ class _$TimestampQueryQuery TimestampQueryDocumentSnapshot? endBeforeDocument, TimestampQueryDocumentSnapshot? startAfterDocument, }) { - final query = $referenceWithoutCursor.orderBy(FieldPath.documentId, - descending: descending); + final query = $referenceWithoutCursor.orderBy( + FieldPath.documentId, + descending: descending, + ); var queryCursor = $queryCursor; if (startAtDocument != null) { @@ -2702,8 +2745,10 @@ class _$TimestampQueryQuery TimestampQueryDocumentSnapshot? endBeforeDocument, TimestampQueryDocumentSnapshot? startAfterDocument, }) { - final query = $referenceWithoutCursor - .orderBy(_$TimestampQueryFieldMap['time']!, descending: descending); + final query = $referenceWithoutCursor.orderBy( + _$TimestampQueryFieldMap['time']!, + descending: descending, + ); var queryCursor = $queryCursor; if (startAtDocument != null) { @@ -2735,7 +2780,7 @@ class _$TimestampQueryQuery queryCursor = queryCursor.copyWith( startAt: [ ...queryCursor.startAt, - _$TimestampQueryPerFieldToJson.time(startAt as Timestamp) + _$TimestampQueryPerFieldToJson.time(startAt as Timestamp), ], startAtDocumentSnapshot: null, ); @@ -2744,7 +2789,7 @@ class _$TimestampQueryQuery queryCursor = queryCursor.copyWith( startAfter: [ ...queryCursor.startAfter, - _$TimestampQueryPerFieldToJson.time(startAfter as Timestamp) + _$TimestampQueryPerFieldToJson.time(startAfter as Timestamp), ], startAfterDocumentSnapshot: null, ); @@ -2753,7 +2798,7 @@ class _$TimestampQueryQuery queryCursor = queryCursor.copyWith( endAt: [ ...queryCursor.endAt, - _$TimestampQueryPerFieldToJson.time(endAt as Timestamp) + _$TimestampQueryPerFieldToJson.time(endAt as Timestamp), ], endAtDocumentSnapshot: null, ); @@ -2762,7 +2807,7 @@ class _$TimestampQueryQuery queryCursor = queryCursor.copyWith( endBefore: [ ...queryCursor.endBefore, - _$TimestampQueryPerFieldToJson.time(endBefore as Timestamp) + _$TimestampQueryPerFieldToJson.time(endBefore as Timestamp), ], endBeforeDocumentSnapshot: null, ); @@ -2795,45 +2840,37 @@ class TimestampQueryDocumentSnapshot @override TimestampQueryDocumentReference get reference { - return TimestampQueryDocumentReference( - snapshot.reference, - ); + return TimestampQueryDocumentReference(snapshot.reference); } @override final TimestampQuery? data; } -class TimestampQueryQuerySnapshot extends FirestoreQuerySnapshot { - TimestampQueryQuerySnapshot._( - this.snapshot, - this.docs, - this.docChanges, - ); +class TimestampQueryQuerySnapshot + extends + FirestoreQuerySnapshot< + TimestampQuery, + TimestampQueryQueryDocumentSnapshot + > { + TimestampQueryQuerySnapshot._(this.snapshot, this.docs, this.docChanges); factory TimestampQueryQuerySnapshot._fromQuerySnapshot( QuerySnapshot snapshot, ) { - final docs = - snapshot.docs.map(TimestampQueryQueryDocumentSnapshot._).toList(); + final docs = snapshot.docs + .map(TimestampQueryQueryDocumentSnapshot._) + .toList(); final docChanges = snapshot.docChanges.map((change) { - return _decodeDocumentChange( - change, - TimestampQueryDocumentSnapshot._, - ); + return _decodeDocumentChange(change, TimestampQueryDocumentSnapshot._); }).toList(); - return TimestampQueryQuerySnapshot._( - snapshot, - docs, - docChanges, - ); + return TimestampQueryQuerySnapshot._(snapshot, docs, docChanges); } static FirestoreDocumentChange - _decodeDocumentChange( + _decodeDocumentChange( DocumentChange docChange, TimestampQueryDocumentSnapshot Function(DocumentSnapshot doc) decodeDoc, ) { @@ -2852,7 +2889,7 @@ class TimestampQueryQuerySnapshot extends FirestoreQuerySnapshot> - docChanges; + docChanges; } class TimestampQueryQueryDocumentSnapshot @@ -2878,11 +2915,12 @@ class TimestampQueryQueryDocumentSnapshot abstract class GeoPointQueryCollectionReference implements GeoPointQueryQuery, - FirestoreCollectionReference { - factory GeoPointQueryCollectionReference([ - FirebaseFirestore? firestore, - ]) = _$GeoPointQueryCollectionReference; + FirestoreCollectionReference< + GeoPointQuery, + GeoPointQueryQuerySnapshot + > { + factory GeoPointQueryCollectionReference([FirebaseFirestore? firestore]) = + _$GeoPointQueryCollectionReference; static GeoPointQuery fromFirestore( DocumentSnapshot> snapshot, @@ -2940,9 +2978,7 @@ class _$GeoPointQueryCollectionReference extends _$GeoPointQueryQuery id == null || id.split('/').length == 1, 'The document ID cannot be from a different collection', ); - return GeoPointQueryDocumentReference( - reference.doc(id), - ); + return GeoPointQueryDocumentReference(reference.doc(id)); } @override @@ -2964,11 +3000,14 @@ class _$GeoPointQueryCollectionReference extends _$GeoPointQueryQuery } abstract class GeoPointQueryDocumentReference - extends FirestoreDocumentReference { + extends + FirestoreDocumentReference< + GeoPointQuery, + GeoPointQueryDocumentSnapshot + > { factory GeoPointQueryDocumentReference( - DocumentReference reference) = - _$GeoPointQueryDocumentReference; + DocumentReference reference, + ) = _$GeoPointQueryDocumentReference; DocumentReference get reference; @@ -3032,10 +3071,7 @@ abstract class GeoPointQueryDocumentReference /// document data. /// /// If no document exists yet, the update will fail. - Future update({ - GeoPoint point, - FieldValue pointFieldValue, - }); + Future update({GeoPoint point, FieldValue pointFieldValue}); /// Updates fields in the current document using the transaction API. /// @@ -3056,9 +3092,10 @@ abstract class GeoPointQueryDocumentReference }); } -class _$GeoPointQueryDocumentReference extends FirestoreDocumentReference< - GeoPointQuery, - GeoPointQueryDocumentSnapshot> implements GeoPointQueryDocumentReference { +class _$GeoPointQueryDocumentReference + extends + FirestoreDocumentReference + implements GeoPointQueryDocumentReference { _$GeoPointQueryDocumentReference(this.reference); @override @@ -3081,7 +3118,8 @@ class _$GeoPointQueryDocumentReference extends FirestoreDocumentReference< @override Future transactionGet( - Transaction transaction) { + Transaction transaction, + ) { return transaction.get(reference).then(GeoPointQueryDocumentSnapshot._); } @@ -3151,8 +3189,10 @@ class _$GeoPointQueryDocumentReference extends FirestoreDocumentReference< ); final json = { if (point != _sentinel) - _$GeoPointQueryFieldMap['point']!: - _$GeoPointQueryPerFieldToJson.point(point as GeoPoint), + _$GeoPointQueryFieldMap['point']!: _$GeoPointQueryPerFieldToJson.point( + point as GeoPoint, + ), + if (pointFieldValue != null) _$GeoPointQueryFieldMap['point']!: pointFieldValue, }; @@ -3171,8 +3211,10 @@ class _$GeoPointQueryDocumentReference extends FirestoreDocumentReference< ); final json = { if (point != _sentinel) - _$GeoPointQueryFieldMap['point']!: - _$GeoPointQueryPerFieldToJson.point(point as GeoPoint), + _$GeoPointQueryFieldMap['point']!: _$GeoPointQueryPerFieldToJson.point( + point as GeoPoint, + ), + if (pointFieldValue != null) _$GeoPointQueryFieldMap['point']!: pointFieldValue, }; @@ -3191,8 +3233,10 @@ class _$GeoPointQueryDocumentReference extends FirestoreDocumentReference< ); final json = { if (point != _sentinel) - _$GeoPointQueryFieldMap['point']!: - _$GeoPointQueryPerFieldToJson.point(point as GeoPoint), + _$GeoPointQueryFieldMap['point']!: _$GeoPointQueryPerFieldToJson.point( + point as GeoPoint, + ), + if (pointFieldValue != null) _$GeoPointQueryFieldMap['point']!: pointFieldValue, }; @@ -3342,17 +3386,17 @@ class _$GeoPointQueryQuery required Query $referenceWithoutCursor, $QueryCursor $queryCursor = const $QueryCursor(), }) : super( - $referenceWithoutCursor: $referenceWithoutCursor, - $queryCursor: $queryCursor, - ); + $referenceWithoutCursor: $referenceWithoutCursor, + $queryCursor: $queryCursor, + ); final CollectionReference _collection; @override Stream snapshots([SnapshotOptions? options]) { - return reference - .snapshots() - .map(GeoPointQueryQuerySnapshot._fromQuerySnapshot); + return reference.snapshots().map( + GeoPointQueryQuerySnapshot._fromQuerySnapshot, + ); } @override @@ -3409,7 +3453,8 @@ class _$GeoPointQueryQuery arrayContainsAny: arrayContainsAny, whereIn: whereIn, whereNotIn: whereNotIn, - isNull: isNull ?? + isNull: + isNull ?? (isEqualTo == null ? false : null) ?? (isNotEqualTo == null ? true : null), ), @@ -3441,7 +3486,8 @@ class _$GeoPointQueryQuery isGreaterThanOrEqualTo: isGreaterThanOrEqualTo, whereIn: whereIn, whereNotIn: whereNotIn, - isNull: isNull ?? + isNull: + isNull ?? (isEqualTo == null ? false : null) ?? (isNotEqualTo == null ? true : null), ), @@ -3475,20 +3521,24 @@ class _$GeoPointQueryQuery ? _$GeoPointQueryPerFieldToJson.point(isLessThan as GeoPoint) : null, isLessThanOrEqualTo: isLessThanOrEqualTo != null - ? _$GeoPointQueryPerFieldToJson - .point(isLessThanOrEqualTo as GeoPoint) + ? _$GeoPointQueryPerFieldToJson.point( + isLessThanOrEqualTo as GeoPoint, + ) : null, isGreaterThan: isGreaterThan != null ? _$GeoPointQueryPerFieldToJson.point(isGreaterThan as GeoPoint) : null, isGreaterThanOrEqualTo: isGreaterThanOrEqualTo != null - ? _$GeoPointQueryPerFieldToJson - .point(isGreaterThanOrEqualTo as GeoPoint) + ? _$GeoPointQueryPerFieldToJson.point( + isGreaterThanOrEqualTo as GeoPoint, + ) : null, whereIn: whereIn?.map((e) => _$GeoPointQueryPerFieldToJson.point(e)), - whereNotIn: - whereNotIn?.map((e) => _$GeoPointQueryPerFieldToJson.point(e)), - isNull: isNull ?? + whereNotIn: whereNotIn?.map( + (e) => _$GeoPointQueryPerFieldToJson.point(e), + ), + isNull: + isNull ?? (isEqualTo == null ? false : null) ?? (isNotEqualTo == null ? true : null), ), @@ -3509,8 +3559,10 @@ class _$GeoPointQueryQuery GeoPointQueryDocumentSnapshot? endBeforeDocument, GeoPointQueryDocumentSnapshot? startAfterDocument, }) { - final query = - $referenceWithoutCursor.orderBy(fieldPath, descending: descending); + final query = $referenceWithoutCursor.orderBy( + fieldPath, + descending: descending, + ); var queryCursor = $queryCursor; if (startAtDocument != null) { @@ -3582,8 +3634,10 @@ class _$GeoPointQueryQuery GeoPointQueryDocumentSnapshot? endBeforeDocument, GeoPointQueryDocumentSnapshot? startAfterDocument, }) { - final query = $referenceWithoutCursor.orderBy(FieldPath.documentId, - descending: descending); + final query = $referenceWithoutCursor.orderBy( + FieldPath.documentId, + descending: descending, + ); var queryCursor = $queryCursor; if (startAtDocument != null) { @@ -3655,8 +3709,10 @@ class _$GeoPointQueryQuery GeoPointQueryDocumentSnapshot? endBeforeDocument, GeoPointQueryDocumentSnapshot? startAfterDocument, }) { - final query = $referenceWithoutCursor - .orderBy(_$GeoPointQueryFieldMap['point']!, descending: descending); + final query = $referenceWithoutCursor.orderBy( + _$GeoPointQueryFieldMap['point']!, + descending: descending, + ); var queryCursor = $queryCursor; if (startAtDocument != null) { @@ -3688,7 +3744,7 @@ class _$GeoPointQueryQuery queryCursor = queryCursor.copyWith( startAt: [ ...queryCursor.startAt, - _$GeoPointQueryPerFieldToJson.point(startAt as GeoPoint) + _$GeoPointQueryPerFieldToJson.point(startAt as GeoPoint), ], startAtDocumentSnapshot: null, ); @@ -3697,7 +3753,7 @@ class _$GeoPointQueryQuery queryCursor = queryCursor.copyWith( startAfter: [ ...queryCursor.startAfter, - _$GeoPointQueryPerFieldToJson.point(startAfter as GeoPoint) + _$GeoPointQueryPerFieldToJson.point(startAfter as GeoPoint), ], startAfterDocumentSnapshot: null, ); @@ -3706,7 +3762,7 @@ class _$GeoPointQueryQuery queryCursor = queryCursor.copyWith( endAt: [ ...queryCursor.endAt, - _$GeoPointQueryPerFieldToJson.point(endAt as GeoPoint) + _$GeoPointQueryPerFieldToJson.point(endAt as GeoPoint), ], endAtDocumentSnapshot: null, ); @@ -3715,7 +3771,7 @@ class _$GeoPointQueryQuery queryCursor = queryCursor.copyWith( endBefore: [ ...queryCursor.endBefore, - _$GeoPointQueryPerFieldToJson.point(endBefore as GeoPoint) + _$GeoPointQueryPerFieldToJson.point(endBefore as GeoPoint), ], endBeforeDocumentSnapshot: null, ); @@ -3748,45 +3804,37 @@ class GeoPointQueryDocumentSnapshot @override GeoPointQueryDocumentReference get reference { - return GeoPointQueryDocumentReference( - snapshot.reference, - ); + return GeoPointQueryDocumentReference(snapshot.reference); } @override final GeoPointQuery? data; } -class GeoPointQueryQuerySnapshot extends FirestoreQuerySnapshot { - GeoPointQueryQuerySnapshot._( - this.snapshot, - this.docs, - this.docChanges, - ); +class GeoPointQueryQuerySnapshot + extends + FirestoreQuerySnapshot< + GeoPointQuery, + GeoPointQueryQueryDocumentSnapshot + > { + GeoPointQueryQuerySnapshot._(this.snapshot, this.docs, this.docChanges); factory GeoPointQueryQuerySnapshot._fromQuerySnapshot( QuerySnapshot snapshot, ) { - final docs = - snapshot.docs.map(GeoPointQueryQueryDocumentSnapshot._).toList(); + final docs = snapshot.docs + .map(GeoPointQueryQueryDocumentSnapshot._) + .toList(); final docChanges = snapshot.docChanges.map((change) { - return _decodeDocumentChange( - change, - GeoPointQueryDocumentSnapshot._, - ); + return _decodeDocumentChange(change, GeoPointQueryDocumentSnapshot._); }).toList(); - return GeoPointQueryQuerySnapshot._( - snapshot, - docs, - docChanges, - ); + return GeoPointQueryQuerySnapshot._(snapshot, docs, docChanges); } static FirestoreDocumentChange - _decodeDocumentChange( + _decodeDocumentChange( DocumentChange docChange, GeoPointQueryDocumentSnapshot Function(DocumentSnapshot doc) decodeDoc, ) { @@ -3830,8 +3878,10 @@ class GeoPointQueryQueryDocumentSnapshot abstract class DocumentReferenceQueryCollectionReference implements DocumentReferenceQueryQuery, - FirestoreCollectionReference { + FirestoreCollectionReference< + DocumentReferenceQuery, + DocumentReferenceQueryQuerySnapshot + > { factory DocumentReferenceQueryCollectionReference([ FirebaseFirestore? firestore, ]) = _$DocumentReferenceQueryCollectionReference; @@ -3859,18 +3909,22 @@ abstract class DocumentReferenceQueryCollectionReference /// Add a new document to this collection with the specified data, /// assigning it a document ID automatically. Future add( - DocumentReferenceQuery value); + DocumentReferenceQuery value, + ); } class _$DocumentReferenceQueryCollectionReference extends _$DocumentReferenceQueryQuery implements DocumentReferenceQueryCollectionReference { - factory _$DocumentReferenceQueryCollectionReference( - [FirebaseFirestore? firestore]) { + factory _$DocumentReferenceQueryCollectionReference([ + FirebaseFirestore? firestore, + ]) { firestore ??= FirebaseFirestore.instance; return _$DocumentReferenceQueryCollectionReference._( - firestore.collection('firestore-example-app/42/doc-ref').withConverter( + firestore + .collection('firestore-example-app/42/doc-ref') + .withConverter( fromFirestore: DocumentReferenceQueryCollectionReference.fromFirestore, toFirestore: DocumentReferenceQueryCollectionReference.toFirestore, @@ -3894,14 +3948,13 @@ class _$DocumentReferenceQueryCollectionReference id == null || id.split('/').length == 1, 'The document ID cannot be from a different collection', ); - return DocumentReferenceQueryDocumentReference( - reference.doc(id), - ); + return DocumentReferenceQueryDocumentReference(reference.doc(id)); } @override Future add( - DocumentReferenceQuery value) { + DocumentReferenceQuery value, + ) { return reference .add(value) .then((ref) => DocumentReferenceQueryDocumentReference(ref)); @@ -3919,11 +3972,14 @@ class _$DocumentReferenceQueryCollectionReference } abstract class DocumentReferenceQueryDocumentReference - extends FirestoreDocumentReference { + extends + FirestoreDocumentReference< + DocumentReferenceQuery, + DocumentReferenceQueryDocumentSnapshot + > { factory DocumentReferenceQueryDocumentReference( - DocumentReference reference) = - _$DocumentReferenceQueryDocumentReference; + DocumentReference reference, + ) = _$DocumentReferenceQueryDocumentReference; DocumentReference get reference; @@ -4012,8 +4068,11 @@ abstract class DocumentReferenceQueryDocumentReference } class _$DocumentReferenceQueryDocumentReference - extends FirestoreDocumentReference + extends + FirestoreDocumentReference< + DocumentReferenceQuery, + DocumentReferenceQueryDocumentSnapshot + > implements DocumentReferenceQueryDocumentReference { _$DocumentReferenceQueryDocumentReference(this.reference); @@ -4039,7 +4098,8 @@ class _$DocumentReferenceQueryDocumentReference @override Future transactionGet( - Transaction transaction) { + Transaction transaction, + ) { return transaction .get(reference) .then(DocumentReferenceQueryDocumentSnapshot._); @@ -4112,8 +4172,10 @@ class _$DocumentReferenceQueryDocumentReference final json = { if (ref != _sentinel) _$DocumentReferenceQueryFieldMap['ref']!: - _$DocumentReferenceQueryPerFieldToJson - .ref(ref as DocumentReference>), + _$DocumentReferenceQueryPerFieldToJson.ref( + ref as DocumentReference>, + ), + if (refFieldValue != null) _$DocumentReferenceQueryFieldMap['ref']!: refFieldValue, }; @@ -4133,8 +4195,10 @@ class _$DocumentReferenceQueryDocumentReference final json = { if (ref != _sentinel) _$DocumentReferenceQueryFieldMap['ref']!: - _$DocumentReferenceQueryPerFieldToJson - .ref(ref as DocumentReference>), + _$DocumentReferenceQueryPerFieldToJson.ref( + ref as DocumentReference>, + ), + if (refFieldValue != null) _$DocumentReferenceQueryFieldMap['ref']!: refFieldValue, }; @@ -4154,8 +4218,10 @@ class _$DocumentReferenceQueryDocumentReference final json = { if (ref != _sentinel) _$DocumentReferenceQueryFieldMap['ref']!: - _$DocumentReferenceQueryPerFieldToJson - .ref(ref as DocumentReference>), + _$DocumentReferenceQueryPerFieldToJson.ref( + ref as DocumentReference>, + ), + if (refFieldValue != null) _$DocumentReferenceQueryFieldMap['ref']!: refFieldValue, }; @@ -4177,8 +4243,10 @@ class _$DocumentReferenceQueryDocumentReference abstract class DocumentReferenceQueryQuery implements - QueryReference { + QueryReference< + DocumentReferenceQuery, + DocumentReferenceQueryQuerySnapshot + > { @override DocumentReferenceQueryQuery limit(int limit); @@ -4299,26 +4367,31 @@ abstract class DocumentReferenceQueryQuery }); } -class _$DocumentReferenceQueryQuery extends QueryReference< - DocumentReferenceQuery, DocumentReferenceQueryQuerySnapshot> +class _$DocumentReferenceQueryQuery + extends + QueryReference< + DocumentReferenceQuery, + DocumentReferenceQueryQuerySnapshot + > implements DocumentReferenceQueryQuery { _$DocumentReferenceQueryQuery( this._collection, { required Query $referenceWithoutCursor, $QueryCursor $queryCursor = const $QueryCursor(), }) : super( - $referenceWithoutCursor: $referenceWithoutCursor, - $queryCursor: $queryCursor, - ); + $referenceWithoutCursor: $referenceWithoutCursor, + $queryCursor: $queryCursor, + ); final CollectionReference _collection; @override - Stream snapshots( - [SnapshotOptions? options]) { - return reference - .snapshots() - .map(DocumentReferenceQueryQuerySnapshot._fromQuerySnapshot); + Stream snapshots([ + SnapshotOptions? options, + ]) { + return reference.snapshots().map( + DocumentReferenceQueryQuerySnapshot._fromQuerySnapshot, + ); } @override @@ -4375,7 +4448,8 @@ class _$DocumentReferenceQueryQuery extends QueryReference< arrayContainsAny: arrayContainsAny, whereIn: whereIn, whereNotIn: whereNotIn, - isNull: isNull ?? + isNull: + isNull ?? (isEqualTo == null ? false : null) ?? (isNotEqualTo == null ? true : null), ), @@ -4407,7 +4481,8 @@ class _$DocumentReferenceQueryQuery extends QueryReference< isGreaterThanOrEqualTo: isGreaterThanOrEqualTo, whereIn: whereIn, whereNotIn: whereNotIn, - isNull: isNull ?? + isNull: + isNull ?? (isEqualTo == null ? false : null) ?? (isNotEqualTo == null ? true : null), ), @@ -4432,34 +4507,44 @@ class _$DocumentReferenceQueryQuery extends QueryReference< $referenceWithoutCursor: $referenceWithoutCursor.where( _$DocumentReferenceQueryFieldMap['ref']!, isEqualTo: isEqualTo != _sentinel - ? _$DocumentReferenceQueryPerFieldToJson - .ref(isEqualTo as DocumentReference>) + ? _$DocumentReferenceQueryPerFieldToJson.ref( + isEqualTo as DocumentReference>, + ) : null, isNotEqualTo: isNotEqualTo != _sentinel - ? _$DocumentReferenceQueryPerFieldToJson - .ref(isNotEqualTo as DocumentReference>) + ? _$DocumentReferenceQueryPerFieldToJson.ref( + isNotEqualTo as DocumentReference>, + ) : null, isLessThan: isLessThan != null - ? _$DocumentReferenceQueryPerFieldToJson - .ref(isLessThan as DocumentReference>) + ? _$DocumentReferenceQueryPerFieldToJson.ref( + isLessThan as DocumentReference>, + ) : null, isLessThanOrEqualTo: isLessThanOrEqualTo != null ? _$DocumentReferenceQueryPerFieldToJson.ref( - isLessThanOrEqualTo as DocumentReference>) + isLessThanOrEqualTo as DocumentReference>, + ) : null, isGreaterThan: isGreaterThan != null - ? _$DocumentReferenceQueryPerFieldToJson - .ref(isGreaterThan as DocumentReference>) + ? _$DocumentReferenceQueryPerFieldToJson.ref( + isGreaterThan as DocumentReference>, + ) : null, isGreaterThanOrEqualTo: isGreaterThanOrEqualTo != null - ? _$DocumentReferenceQueryPerFieldToJson.ref(isGreaterThanOrEqualTo - as DocumentReference>) + ? _$DocumentReferenceQueryPerFieldToJson.ref( + isGreaterThanOrEqualTo + as DocumentReference>, + ) : null, - whereIn: - whereIn?.map((e) => _$DocumentReferenceQueryPerFieldToJson.ref(e)), - whereNotIn: whereNotIn - ?.map((e) => _$DocumentReferenceQueryPerFieldToJson.ref(e)), - isNull: isNull ?? + whereIn: whereIn?.map( + (e) => _$DocumentReferenceQueryPerFieldToJson.ref(e), + ), + whereNotIn: whereNotIn?.map( + (e) => _$DocumentReferenceQueryPerFieldToJson.ref(e), + ), + isNull: + isNull ?? (isEqualTo == null ? false : null) ?? (isNotEqualTo == null ? true : null), ), @@ -4480,8 +4565,10 @@ class _$DocumentReferenceQueryQuery extends QueryReference< DocumentReferenceQueryDocumentSnapshot? endBeforeDocument, DocumentReferenceQueryDocumentSnapshot? startAfterDocument, }) { - final query = - $referenceWithoutCursor.orderBy(fieldPath, descending: descending); + final query = $referenceWithoutCursor.orderBy( + fieldPath, + descending: descending, + ); var queryCursor = $queryCursor; if (startAtDocument != null) { @@ -4553,8 +4640,10 @@ class _$DocumentReferenceQueryQuery extends QueryReference< DocumentReferenceQueryDocumentSnapshot? endBeforeDocument, DocumentReferenceQueryDocumentSnapshot? startAfterDocument, }) { - final query = $referenceWithoutCursor.orderBy(FieldPath.documentId, - descending: descending); + final query = $referenceWithoutCursor.orderBy( + FieldPath.documentId, + descending: descending, + ); var queryCursor = $queryCursor; if (startAtDocument != null) { @@ -4627,8 +4716,9 @@ class _$DocumentReferenceQueryQuery extends QueryReference< DocumentReferenceQueryDocumentSnapshot? startAfterDocument, }) { final query = $referenceWithoutCursor.orderBy( - _$DocumentReferenceQueryFieldMap['ref']!, - descending: descending); + _$DocumentReferenceQueryFieldMap['ref']!, + descending: descending, + ); var queryCursor = $queryCursor; if (startAtDocument != null) { @@ -4660,8 +4750,9 @@ class _$DocumentReferenceQueryQuery extends QueryReference< queryCursor = queryCursor.copyWith( startAt: [ ...queryCursor.startAt, - _$DocumentReferenceQueryPerFieldToJson - .ref(startAt as DocumentReference>) + _$DocumentReferenceQueryPerFieldToJson.ref( + startAt as DocumentReference>, + ), ], startAtDocumentSnapshot: null, ); @@ -4670,8 +4761,9 @@ class _$DocumentReferenceQueryQuery extends QueryReference< queryCursor = queryCursor.copyWith( startAfter: [ ...queryCursor.startAfter, - _$DocumentReferenceQueryPerFieldToJson - .ref(startAfter as DocumentReference>) + _$DocumentReferenceQueryPerFieldToJson.ref( + startAfter as DocumentReference>, + ), ], startAfterDocumentSnapshot: null, ); @@ -4680,8 +4772,9 @@ class _$DocumentReferenceQueryQuery extends QueryReference< queryCursor = queryCursor.copyWith( endAt: [ ...queryCursor.endAt, - _$DocumentReferenceQueryPerFieldToJson - .ref(endAt as DocumentReference>) + _$DocumentReferenceQueryPerFieldToJson.ref( + endAt as DocumentReference>, + ), ], endAtDocumentSnapshot: null, ); @@ -4690,8 +4783,9 @@ class _$DocumentReferenceQueryQuery extends QueryReference< queryCursor = queryCursor.copyWith( endBefore: [ ...queryCursor.endBefore, - _$DocumentReferenceQueryPerFieldToJson - .ref(endBefore as DocumentReference>) + _$DocumentReferenceQueryPerFieldToJson.ref( + endBefore as DocumentReference>, + ), ], endBeforeDocumentSnapshot: null, ); @@ -4718,24 +4812,26 @@ class _$DocumentReferenceQueryQuery extends QueryReference< class DocumentReferenceQueryDocumentSnapshot extends FirestoreDocumentSnapshot { DocumentReferenceQueryDocumentSnapshot._(this.snapshot) - : data = snapshot.data(); + : data = snapshot.data(); @override final DocumentSnapshot snapshot; @override DocumentReferenceQueryDocumentReference get reference { - return DocumentReferenceQueryDocumentReference( - snapshot.reference, - ); + return DocumentReferenceQueryDocumentReference(snapshot.reference); } @override final DocumentReferenceQuery? data; } -class DocumentReferenceQueryQuerySnapshot extends FirestoreQuerySnapshot< - DocumentReferenceQuery, DocumentReferenceQueryQueryDocumentSnapshot> { +class DocumentReferenceQueryQuerySnapshot + extends + FirestoreQuerySnapshot< + DocumentReferenceQuery, + DocumentReferenceQueryQueryDocumentSnapshot + > { DocumentReferenceQueryQuerySnapshot._( this.snapshot, this.docs, @@ -4756,18 +4852,14 @@ class DocumentReferenceQueryQuerySnapshot extends FirestoreQuerySnapshot< ); }).toList(); - return DocumentReferenceQueryQuerySnapshot._( - snapshot, - docs, - docChanges, - ); + return DocumentReferenceQueryQuerySnapshot._(snapshot, docs, docChanges); } static FirestoreDocumentChange - _decodeDocumentChange( + _decodeDocumentChange( DocumentChange docChange, DocumentReferenceQueryDocumentSnapshot Function(DocumentSnapshot doc) - decodeDoc, + decodeDoc, ) { return FirestoreDocumentChange( type: docChange.type, @@ -4784,14 +4876,14 @@ class DocumentReferenceQueryQuerySnapshot extends FirestoreQuerySnapshot< @override final List> - docChanges; + docChanges; } class DocumentReferenceQueryQueryDocumentSnapshot extends FirestoreQueryDocumentSnapshot implements DocumentReferenceQueryDocumentSnapshot { DocumentReferenceQueryQueryDocumentSnapshot._(this.snapshot) - : data = snapshot.data(); + : data = snapshot.data(); @override final QueryDocumentSnapshot snapshot; @@ -4810,13 +4902,9 @@ class DocumentReferenceQueryQueryDocumentSnapshot // ************************************************************************** DurationQuery _$DurationQueryFromJson(Map json) => - DurationQuery( - Duration(microseconds: (json['duration'] as num).toInt()), - ); + DurationQuery(Duration(microseconds: (json['duration'] as num).toInt())); -const _$DurationQueryFieldMap = { - 'duration': 'duration', -}; +const _$DurationQueryFieldMap = {'duration': 'duration'}; // ignore: unused_element abstract class _$DurationQueryPerFieldToJson { @@ -4825,18 +4913,14 @@ abstract class _$DurationQueryPerFieldToJson { } Map _$DurationQueryToJson(DurationQuery instance) => - { - 'duration': instance.duration.inMicroseconds, - }; + {'duration': instance.duration.inMicroseconds}; DateTimeQuery _$DateTimeQueryFromJson(Map json) => DateTimeQuery( const FirestoreDateTimeConverter().fromJson(json['time'] as Timestamp), ); -const _$DateTimeQueryFieldMap = { - 'time': 'time', -}; +const _$DateTimeQueryFieldMap = {'time': 'time'}; // ignore: unused_element abstract class _$DateTimeQueryPerFieldToJson { @@ -4855,9 +4939,7 @@ TimestampQuery _$TimestampQueryFromJson(Map json) => const FirestoreTimestampConverter().fromJson(json['time'] as Timestamp), ); -const _$TimestampQueryFieldMap = { - 'time': 'time', -}; +const _$TimestampQueryFieldMap = {'time': 'time'}; // ignore: unused_element abstract class _$TimestampQueryPerFieldToJson { @@ -4876,9 +4958,7 @@ GeoPointQuery _$GeoPointQueryFromJson(Map json) => const FirestoreGeoPointConverter().fromJson(json['point'] as GeoPoint), ); -const _$GeoPointQueryFieldMap = { - 'point': 'point', -}; +const _$GeoPointQueryFieldMap = {'point': 'point'}; // ignore: unused_element abstract class _$GeoPointQueryPerFieldToJson { @@ -4893,15 +4973,14 @@ Map _$GeoPointQueryToJson(GeoPointQuery instance) => }; DocumentReferenceQuery _$DocumentReferenceQueryFromJson( - Map json) => - DocumentReferenceQuery( - const FirestoreDocumentReferenceConverter() - .fromJson(json['ref'] as DocumentReference>), - ); + Map json, +) => DocumentReferenceQuery( + const FirestoreDocumentReferenceConverter().fromJson( + json['ref'] as DocumentReference>, + ), +); -const _$DocumentReferenceQueryFieldMap = { - 'ref': 'ref', -}; +const _$DocumentReferenceQueryFieldMap = {'ref': 'ref'}; // ignore: unused_element abstract class _$DocumentReferenceQueryPerFieldToJson { @@ -4911,7 +4990,7 @@ abstract class _$DocumentReferenceQueryPerFieldToJson { } Map _$DocumentReferenceQueryToJson( - DocumentReferenceQuery instance) => - { - 'ref': const FirestoreDocumentReferenceConverter().toJson(instance.ref), - }; + DocumentReferenceQuery instance, +) => { + 'ref': const FirestoreDocumentReferenceConverter().toJson(instance.ref), +}; diff --git a/packages/cloud_firestore_odm/example/lib/movie.g.dart b/packages/cloud_firestore_odm/example/lib/movie.g.dart index 17aee54..a1b19f3 100644 --- a/packages/cloud_firestore_odm/example/lib/movie.g.dart +++ b/packages/cloud_firestore_odm/example/lib/movie.g.dart @@ -26,9 +26,8 @@ abstract class MovieCollectionReference implements MovieQuery, FirestoreCollectionReference { - factory MovieCollectionReference([ - FirebaseFirestore? firestore, - ]) = _$MovieCollectionReference; + factory MovieCollectionReference([FirebaseFirestore? firestore]) = + _$MovieCollectionReference; static Movie fromFirestore( DocumentSnapshot> snapshot, @@ -37,10 +36,7 @@ abstract class MovieCollectionReference return _$MovieFromJson({'id': snapshot.id, ...?snapshot.data()}); } - static Map toFirestore( - Movie value, - SetOptions? options, - ) { + static Map toFirestore(Movie value, SetOptions? options) { return {..._$MovieToJson(value)}..remove('id'); } @@ -61,16 +57,17 @@ class _$MovieCollectionReference extends _$MovieQuery firestore ??= FirebaseFirestore.instance; return _$MovieCollectionReference._( - firestore.collection('firestore-example-app').withConverter( + firestore + .collection('firestore-example-app') + .withConverter( fromFirestore: MovieCollectionReference.fromFirestore, toFirestore: MovieCollectionReference.toFirestore, ), ); } - _$MovieCollectionReference._( - CollectionReference reference, - ) : super(reference, $referenceWithoutCursor: reference); + _$MovieCollectionReference._(CollectionReference reference) + : super(reference, $referenceWithoutCursor: reference); String get path => reference.path; @@ -84,9 +81,7 @@ class _$MovieCollectionReference extends _$MovieQuery id == null || id.split('/').length == 1, 'The document ID cannot be from a different collection', ); - return MovieDocumentReference( - reference.doc(id), - ); + return MovieDocumentReference(reference.doc(id)); } @override @@ -311,13 +306,20 @@ class _$MovieDocumentReference ..._$MovieToJson(model), if (posterFieldValue != null) _$MovieFieldMap['poster']!: posterFieldValue, + if (likesFieldValue != null) _$MovieFieldMap['likes']!: likesFieldValue, + if (titleFieldValue != null) _$MovieFieldMap['title']!: titleFieldValue, + if (yearFieldValue != null) _$MovieFieldMap['year']!: yearFieldValue, + if (runtimeFieldValue != null) _$MovieFieldMap['runtime']!: runtimeFieldValue, + if (ratedFieldValue != null) _$MovieFieldMap['rated']!: ratedFieldValue, + if (genreFieldValue != null) _$MovieFieldMap['genre']!: genreFieldValue, + if (tagsFieldValue != null) _$MovieFieldMap['tags']!: tagsFieldValue, }; @@ -345,13 +347,20 @@ class _$MovieDocumentReference ..._$MovieToJson(model), if (posterFieldValue != null) _$MovieFieldMap['poster']!: posterFieldValue, + if (likesFieldValue != null) _$MovieFieldMap['likes']!: likesFieldValue, + if (titleFieldValue != null) _$MovieFieldMap['title']!: titleFieldValue, + if (yearFieldValue != null) _$MovieFieldMap['year']!: yearFieldValue, + if (runtimeFieldValue != null) _$MovieFieldMap['runtime']!: runtimeFieldValue, + if (ratedFieldValue != null) _$MovieFieldMap['rated']!: ratedFieldValue, + if (genreFieldValue != null) _$MovieFieldMap['genre']!: genreFieldValue, + if (tagsFieldValue != null) _$MovieFieldMap['tags']!: tagsFieldValue, }; @@ -379,13 +388,20 @@ class _$MovieDocumentReference ..._$MovieToJson(model), if (posterFieldValue != null) _$MovieFieldMap['poster']!: posterFieldValue, + if (likesFieldValue != null) _$MovieFieldMap['likes']!: likesFieldValue, + if (titleFieldValue != null) _$MovieFieldMap['title']!: titleFieldValue, + if (yearFieldValue != null) _$MovieFieldMap['year']!: yearFieldValue, + if (runtimeFieldValue != null) _$MovieFieldMap['runtime']!: runtimeFieldValue, + if (ratedFieldValue != null) _$MovieFieldMap['rated']!: ratedFieldValue, + if (genreFieldValue != null) _$MovieFieldMap['genre']!: genreFieldValue, + if (tagsFieldValue != null) _$MovieFieldMap['tags']!: tagsFieldValue, }; @@ -448,34 +464,53 @@ class _$MovieDocumentReference ); final json = { if (poster != _sentinel) - _$MovieFieldMap['poster']!: - _$MoviePerFieldToJson.poster(poster as String), + _$MovieFieldMap['poster']!: _$MoviePerFieldToJson.poster( + poster as String, + ), + if (posterFieldValue != null) _$MovieFieldMap['poster']!: posterFieldValue, + if (likes != _sentinel) _$MovieFieldMap['likes']!: _$MoviePerFieldToJson.likes(likes as int), + if (likesFieldValue != null) _$MovieFieldMap['likes']!: likesFieldValue, + if (title != _sentinel) _$MovieFieldMap['title']!: _$MoviePerFieldToJson.title(title as String), + if (titleFieldValue != null) _$MovieFieldMap['title']!: titleFieldValue, + if (year != _sentinel) _$MovieFieldMap['year']!: _$MoviePerFieldToJson.year(year as int), + if (yearFieldValue != null) _$MovieFieldMap['year']!: yearFieldValue, + if (runtime != _sentinel) - _$MovieFieldMap['runtime']!: - _$MoviePerFieldToJson.runtime(runtime as String), + _$MovieFieldMap['runtime']!: _$MoviePerFieldToJson.runtime( + runtime as String, + ), + if (runtimeFieldValue != null) _$MovieFieldMap['runtime']!: runtimeFieldValue, + if (rated != _sentinel) _$MovieFieldMap['rated']!: _$MoviePerFieldToJson.rated(rated as String), + if (ratedFieldValue != null) _$MovieFieldMap['rated']!: ratedFieldValue, + if (genre != _sentinel) - _$MovieFieldMap['genre']!: - _$MoviePerFieldToJson.genre(genre as List?), + _$MovieFieldMap['genre']!: _$MoviePerFieldToJson.genre( + genre as List?, + ), + if (genreFieldValue != null) _$MovieFieldMap['genre']!: genreFieldValue, + if (tags != _sentinel) - _$MovieFieldMap['tags']!: - _$MoviePerFieldToJson.tags(tags as Set?), + _$MovieFieldMap['tags']!: _$MoviePerFieldToJson.tags( + tags as Set?, + ), + if (tagsFieldValue != null) _$MovieFieldMap['tags']!: tagsFieldValue, }; @@ -535,34 +570,53 @@ class _$MovieDocumentReference ); final json = { if (poster != _sentinel) - _$MovieFieldMap['poster']!: - _$MoviePerFieldToJson.poster(poster as String), + _$MovieFieldMap['poster']!: _$MoviePerFieldToJson.poster( + poster as String, + ), + if (posterFieldValue != null) _$MovieFieldMap['poster']!: posterFieldValue, + if (likes != _sentinel) _$MovieFieldMap['likes']!: _$MoviePerFieldToJson.likes(likes as int), + if (likesFieldValue != null) _$MovieFieldMap['likes']!: likesFieldValue, + if (title != _sentinel) _$MovieFieldMap['title']!: _$MoviePerFieldToJson.title(title as String), + if (titleFieldValue != null) _$MovieFieldMap['title']!: titleFieldValue, + if (year != _sentinel) _$MovieFieldMap['year']!: _$MoviePerFieldToJson.year(year as int), + if (yearFieldValue != null) _$MovieFieldMap['year']!: yearFieldValue, + if (runtime != _sentinel) - _$MovieFieldMap['runtime']!: - _$MoviePerFieldToJson.runtime(runtime as String), + _$MovieFieldMap['runtime']!: _$MoviePerFieldToJson.runtime( + runtime as String, + ), + if (runtimeFieldValue != null) _$MovieFieldMap['runtime']!: runtimeFieldValue, + if (rated != _sentinel) _$MovieFieldMap['rated']!: _$MoviePerFieldToJson.rated(rated as String), + if (ratedFieldValue != null) _$MovieFieldMap['rated']!: ratedFieldValue, + if (genre != _sentinel) - _$MovieFieldMap['genre']!: - _$MoviePerFieldToJson.genre(genre as List?), + _$MovieFieldMap['genre']!: _$MoviePerFieldToJson.genre( + genre as List?, + ), + if (genreFieldValue != null) _$MovieFieldMap['genre']!: genreFieldValue, + if (tags != _sentinel) - _$MovieFieldMap['tags']!: - _$MoviePerFieldToJson.tags(tags as Set?), + _$MovieFieldMap['tags']!: _$MoviePerFieldToJson.tags( + tags as Set?, + ), + if (tagsFieldValue != null) _$MovieFieldMap['tags']!: tagsFieldValue, }; @@ -622,34 +676,53 @@ class _$MovieDocumentReference ); final json = { if (poster != _sentinel) - _$MovieFieldMap['poster']!: - _$MoviePerFieldToJson.poster(poster as String), + _$MovieFieldMap['poster']!: _$MoviePerFieldToJson.poster( + poster as String, + ), + if (posterFieldValue != null) _$MovieFieldMap['poster']!: posterFieldValue, + if (likes != _sentinel) _$MovieFieldMap['likes']!: _$MoviePerFieldToJson.likes(likes as int), + if (likesFieldValue != null) _$MovieFieldMap['likes']!: likesFieldValue, + if (title != _sentinel) _$MovieFieldMap['title']!: _$MoviePerFieldToJson.title(title as String), + if (titleFieldValue != null) _$MovieFieldMap['title']!: titleFieldValue, + if (year != _sentinel) _$MovieFieldMap['year']!: _$MoviePerFieldToJson.year(year as int), + if (yearFieldValue != null) _$MovieFieldMap['year']!: yearFieldValue, + if (runtime != _sentinel) - _$MovieFieldMap['runtime']!: - _$MoviePerFieldToJson.runtime(runtime as String), + _$MovieFieldMap['runtime']!: _$MoviePerFieldToJson.runtime( + runtime as String, + ), + if (runtimeFieldValue != null) _$MovieFieldMap['runtime']!: runtimeFieldValue, + if (rated != _sentinel) _$MovieFieldMap['rated']!: _$MoviePerFieldToJson.rated(rated as String), + if (ratedFieldValue != null) _$MovieFieldMap['rated']!: ratedFieldValue, + if (genre != _sentinel) - _$MovieFieldMap['genre']!: - _$MoviePerFieldToJson.genre(genre as List?), + _$MovieFieldMap['genre']!: _$MoviePerFieldToJson.genre( + genre as List?, + ), + if (genreFieldValue != null) _$MovieFieldMap['genre']!: genreFieldValue, + if (tags != _sentinel) - _$MovieFieldMap['tags']!: - _$MoviePerFieldToJson.tags(tags as Set?), + _$MovieFieldMap['tags']!: _$MoviePerFieldToJson.tags( + tags as Set?, + ), + if (tagsFieldValue != null) _$MovieFieldMap['tags']!: tagsFieldValue, }; @@ -964,9 +1037,9 @@ class _$MovieQuery extends QueryReference required Query $referenceWithoutCursor, $QueryCursor $queryCursor = const $QueryCursor(), }) : super( - $referenceWithoutCursor: $referenceWithoutCursor, - $queryCursor: $queryCursor, - ); + $referenceWithoutCursor: $referenceWithoutCursor, + $queryCursor: $queryCursor, + ); final CollectionReference _collection; @@ -1027,7 +1100,8 @@ class _$MovieQuery extends QueryReference arrayContainsAny: arrayContainsAny, whereIn: whereIn, whereNotIn: whereNotIn, - isNull: isNull ?? + isNull: + isNull ?? (isEqualTo == null ? false : null) ?? (isNotEqualTo == null ? true : null), ), @@ -1059,7 +1133,8 @@ class _$MovieQuery extends QueryReference isGreaterThanOrEqualTo: isGreaterThanOrEqualTo, whereIn: whereIn, whereNotIn: whereNotIn, - isNull: isNull ?? + isNull: + isNull ?? (isEqualTo == null ? false : null) ?? (isNotEqualTo == null ? true : null), ), @@ -1103,7 +1178,8 @@ class _$MovieQuery extends QueryReference : null, whereIn: whereIn?.map((e) => _$MoviePerFieldToJson.poster(e)), whereNotIn: whereNotIn?.map((e) => _$MoviePerFieldToJson.poster(e)), - isNull: isNull ?? + isNull: + isNull ?? (isEqualTo == null ? false : null) ?? (isNotEqualTo == null ? true : null), ), @@ -1147,7 +1223,8 @@ class _$MovieQuery extends QueryReference : null, whereIn: whereIn?.map((e) => _$MoviePerFieldToJson.likes(e)), whereNotIn: whereNotIn?.map((e) => _$MoviePerFieldToJson.likes(e)), - isNull: isNull ?? + isNull: + isNull ?? (isEqualTo == null ? false : null) ?? (isNotEqualTo == null ? true : null), ), @@ -1191,7 +1268,8 @@ class _$MovieQuery extends QueryReference : null, whereIn: whereIn?.map((e) => _$MoviePerFieldToJson.title(e)), whereNotIn: whereNotIn?.map((e) => _$MoviePerFieldToJson.title(e)), - isNull: isNull ?? + isNull: + isNull ?? (isEqualTo == null ? false : null) ?? (isNotEqualTo == null ? true : null), ), @@ -1235,7 +1313,8 @@ class _$MovieQuery extends QueryReference : null, whereIn: whereIn?.map((e) => _$MoviePerFieldToJson.year(e)), whereNotIn: whereNotIn?.map((e) => _$MoviePerFieldToJson.year(e)), - isNull: isNull ?? + isNull: + isNull ?? (isEqualTo == null ? false : null) ?? (isNotEqualTo == null ? true : null), ), @@ -1279,7 +1358,8 @@ class _$MovieQuery extends QueryReference : null, whereIn: whereIn?.map((e) => _$MoviePerFieldToJson.runtime(e)), whereNotIn: whereNotIn?.map((e) => _$MoviePerFieldToJson.runtime(e)), - isNull: isNull ?? + isNull: + isNull ?? (isEqualTo == null ? false : null) ?? (isNotEqualTo == null ? true : null), ), @@ -1323,7 +1403,8 @@ class _$MovieQuery extends QueryReference : null, whereIn: whereIn?.map((e) => _$MoviePerFieldToJson.rated(e)), whereNotIn: whereNotIn?.map((e) => _$MoviePerFieldToJson.rated(e)), - isNull: isNull ?? + isNull: + isNull ?? (isEqualTo == null ? false : null) ?? (isNotEqualTo == null ? true : null), ), @@ -1363,17 +1444,19 @@ class _$MovieQuery extends QueryReference ? _$MoviePerFieldToJson.genre(isGreaterThan as List?) : null, isGreaterThanOrEqualTo: isGreaterThanOrEqualTo != null - ? _$MoviePerFieldToJson - .genre(isGreaterThanOrEqualTo as List?) + ? _$MoviePerFieldToJson.genre( + isGreaterThanOrEqualTo as List?, + ) : null, arrayContains: arrayContains != null ? (_$MoviePerFieldToJson.genre([arrayContains as String]) as List?)! - .single + .single : null, arrayContainsAny: arrayContainsAny != null ? _$MoviePerFieldToJson.genre(arrayContainsAny) as Iterable? : null, - isNull: isNull ?? + isNull: + isNull ?? (isEqualTo == null ? false : null) ?? (isNotEqualTo == null ? true : null), ), @@ -1417,12 +1500,13 @@ class _$MovieQuery extends QueryReference : null, arrayContains: arrayContains != null ? (_$MoviePerFieldToJson.tags({arrayContains as String}) as List?)! - .single + .single : null, arrayContainsAny: arrayContainsAny != null ? _$MoviePerFieldToJson.tags(arrayContainsAny) as Iterable? : null, - isNull: isNull ?? + isNull: + isNull ?? (isEqualTo == null ? false : null) ?? (isNotEqualTo == null ? true : null), ), @@ -1443,8 +1527,10 @@ class _$MovieQuery extends QueryReference MovieDocumentSnapshot? endBeforeDocument, MovieDocumentSnapshot? startAfterDocument, }) { - final query = - $referenceWithoutCursor.orderBy(fieldPath, descending: descending); + final query = $referenceWithoutCursor.orderBy( + fieldPath, + descending: descending, + ); var queryCursor = $queryCursor; if (startAtDocument != null) { @@ -1516,8 +1602,10 @@ class _$MovieQuery extends QueryReference MovieDocumentSnapshot? endBeforeDocument, MovieDocumentSnapshot? startAfterDocument, }) { - final query = $referenceWithoutCursor.orderBy(FieldPath.documentId, - descending: descending); + final query = $referenceWithoutCursor.orderBy( + FieldPath.documentId, + descending: descending, + ); var queryCursor = $queryCursor; if (startAtDocument != null) { @@ -1589,8 +1677,10 @@ class _$MovieQuery extends QueryReference MovieDocumentSnapshot? endBeforeDocument, MovieDocumentSnapshot? startAfterDocument, }) { - final query = $referenceWithoutCursor.orderBy(_$MovieFieldMap['poster']!, - descending: descending); + final query = $referenceWithoutCursor.orderBy( + _$MovieFieldMap['poster']!, + descending: descending, + ); var queryCursor = $queryCursor; if (startAtDocument != null) { @@ -1622,7 +1712,7 @@ class _$MovieQuery extends QueryReference queryCursor = queryCursor.copyWith( startAt: [ ...queryCursor.startAt, - _$MoviePerFieldToJson.poster(startAt as String) + _$MoviePerFieldToJson.poster(startAt as String), ], startAtDocumentSnapshot: null, ); @@ -1631,7 +1721,7 @@ class _$MovieQuery extends QueryReference queryCursor = queryCursor.copyWith( startAfter: [ ...queryCursor.startAfter, - _$MoviePerFieldToJson.poster(startAfter as String) + _$MoviePerFieldToJson.poster(startAfter as String), ], startAfterDocumentSnapshot: null, ); @@ -1640,7 +1730,7 @@ class _$MovieQuery extends QueryReference queryCursor = queryCursor.copyWith( endAt: [ ...queryCursor.endAt, - _$MoviePerFieldToJson.poster(endAt as String) + _$MoviePerFieldToJson.poster(endAt as String), ], endAtDocumentSnapshot: null, ); @@ -1649,7 +1739,7 @@ class _$MovieQuery extends QueryReference queryCursor = queryCursor.copyWith( endBefore: [ ...queryCursor.endBefore, - _$MoviePerFieldToJson.poster(endBefore as String) + _$MoviePerFieldToJson.poster(endBefore as String), ], endBeforeDocumentSnapshot: null, ); @@ -1674,8 +1764,10 @@ class _$MovieQuery extends QueryReference MovieDocumentSnapshot? endBeforeDocument, MovieDocumentSnapshot? startAfterDocument, }) { - final query = $referenceWithoutCursor.orderBy(_$MovieFieldMap['likes']!, - descending: descending); + final query = $referenceWithoutCursor.orderBy( + _$MovieFieldMap['likes']!, + descending: descending, + ); var queryCursor = $queryCursor; if (startAtDocument != null) { @@ -1707,7 +1799,7 @@ class _$MovieQuery extends QueryReference queryCursor = queryCursor.copyWith( startAt: [ ...queryCursor.startAt, - _$MoviePerFieldToJson.likes(startAt as int) + _$MoviePerFieldToJson.likes(startAt as int), ], startAtDocumentSnapshot: null, ); @@ -1716,7 +1808,7 @@ class _$MovieQuery extends QueryReference queryCursor = queryCursor.copyWith( startAfter: [ ...queryCursor.startAfter, - _$MoviePerFieldToJson.likes(startAfter as int) + _$MoviePerFieldToJson.likes(startAfter as int), ], startAfterDocumentSnapshot: null, ); @@ -1725,7 +1817,7 @@ class _$MovieQuery extends QueryReference queryCursor = queryCursor.copyWith( endAt: [ ...queryCursor.endAt, - _$MoviePerFieldToJson.likes(endAt as int) + _$MoviePerFieldToJson.likes(endAt as int), ], endAtDocumentSnapshot: null, ); @@ -1734,7 +1826,7 @@ class _$MovieQuery extends QueryReference queryCursor = queryCursor.copyWith( endBefore: [ ...queryCursor.endBefore, - _$MoviePerFieldToJson.likes(endBefore as int) + _$MoviePerFieldToJson.likes(endBefore as int), ], endBeforeDocumentSnapshot: null, ); @@ -1759,8 +1851,10 @@ class _$MovieQuery extends QueryReference MovieDocumentSnapshot? endBeforeDocument, MovieDocumentSnapshot? startAfterDocument, }) { - final query = $referenceWithoutCursor.orderBy(_$MovieFieldMap['title']!, - descending: descending); + final query = $referenceWithoutCursor.orderBy( + _$MovieFieldMap['title']!, + descending: descending, + ); var queryCursor = $queryCursor; if (startAtDocument != null) { @@ -1792,7 +1886,7 @@ class _$MovieQuery extends QueryReference queryCursor = queryCursor.copyWith( startAt: [ ...queryCursor.startAt, - _$MoviePerFieldToJson.title(startAt as String) + _$MoviePerFieldToJson.title(startAt as String), ], startAtDocumentSnapshot: null, ); @@ -1801,7 +1895,7 @@ class _$MovieQuery extends QueryReference queryCursor = queryCursor.copyWith( startAfter: [ ...queryCursor.startAfter, - _$MoviePerFieldToJson.title(startAfter as String) + _$MoviePerFieldToJson.title(startAfter as String), ], startAfterDocumentSnapshot: null, ); @@ -1810,7 +1904,7 @@ class _$MovieQuery extends QueryReference queryCursor = queryCursor.copyWith( endAt: [ ...queryCursor.endAt, - _$MoviePerFieldToJson.title(endAt as String) + _$MoviePerFieldToJson.title(endAt as String), ], endAtDocumentSnapshot: null, ); @@ -1819,7 +1913,7 @@ class _$MovieQuery extends QueryReference queryCursor = queryCursor.copyWith( endBefore: [ ...queryCursor.endBefore, - _$MoviePerFieldToJson.title(endBefore as String) + _$MoviePerFieldToJson.title(endBefore as String), ], endBeforeDocumentSnapshot: null, ); @@ -1844,8 +1938,10 @@ class _$MovieQuery extends QueryReference MovieDocumentSnapshot? endBeforeDocument, MovieDocumentSnapshot? startAfterDocument, }) { - final query = $referenceWithoutCursor.orderBy(_$MovieFieldMap['year']!, - descending: descending); + final query = $referenceWithoutCursor.orderBy( + _$MovieFieldMap['year']!, + descending: descending, + ); var queryCursor = $queryCursor; if (startAtDocument != null) { @@ -1877,7 +1973,7 @@ class _$MovieQuery extends QueryReference queryCursor = queryCursor.copyWith( startAt: [ ...queryCursor.startAt, - _$MoviePerFieldToJson.year(startAt as int) + _$MoviePerFieldToJson.year(startAt as int), ], startAtDocumentSnapshot: null, ); @@ -1886,7 +1982,7 @@ class _$MovieQuery extends QueryReference queryCursor = queryCursor.copyWith( startAfter: [ ...queryCursor.startAfter, - _$MoviePerFieldToJson.year(startAfter as int) + _$MoviePerFieldToJson.year(startAfter as int), ], startAfterDocumentSnapshot: null, ); @@ -1901,7 +1997,7 @@ class _$MovieQuery extends QueryReference queryCursor = queryCursor.copyWith( endBefore: [ ...queryCursor.endBefore, - _$MoviePerFieldToJson.year(endBefore as int) + _$MoviePerFieldToJson.year(endBefore as int), ], endBeforeDocumentSnapshot: null, ); @@ -1926,8 +2022,10 @@ class _$MovieQuery extends QueryReference MovieDocumentSnapshot? endBeforeDocument, MovieDocumentSnapshot? startAfterDocument, }) { - final query = $referenceWithoutCursor.orderBy(_$MovieFieldMap['runtime']!, - descending: descending); + final query = $referenceWithoutCursor.orderBy( + _$MovieFieldMap['runtime']!, + descending: descending, + ); var queryCursor = $queryCursor; if (startAtDocument != null) { @@ -1959,7 +2057,7 @@ class _$MovieQuery extends QueryReference queryCursor = queryCursor.copyWith( startAt: [ ...queryCursor.startAt, - _$MoviePerFieldToJson.runtime(startAt as String) + _$MoviePerFieldToJson.runtime(startAt as String), ], startAtDocumentSnapshot: null, ); @@ -1968,7 +2066,7 @@ class _$MovieQuery extends QueryReference queryCursor = queryCursor.copyWith( startAfter: [ ...queryCursor.startAfter, - _$MoviePerFieldToJson.runtime(startAfter as String) + _$MoviePerFieldToJson.runtime(startAfter as String), ], startAfterDocumentSnapshot: null, ); @@ -1977,7 +2075,7 @@ class _$MovieQuery extends QueryReference queryCursor = queryCursor.copyWith( endAt: [ ...queryCursor.endAt, - _$MoviePerFieldToJson.runtime(endAt as String) + _$MoviePerFieldToJson.runtime(endAt as String), ], endAtDocumentSnapshot: null, ); @@ -1986,7 +2084,7 @@ class _$MovieQuery extends QueryReference queryCursor = queryCursor.copyWith( endBefore: [ ...queryCursor.endBefore, - _$MoviePerFieldToJson.runtime(endBefore as String) + _$MoviePerFieldToJson.runtime(endBefore as String), ], endBeforeDocumentSnapshot: null, ); @@ -2011,8 +2109,10 @@ class _$MovieQuery extends QueryReference MovieDocumentSnapshot? endBeforeDocument, MovieDocumentSnapshot? startAfterDocument, }) { - final query = $referenceWithoutCursor.orderBy(_$MovieFieldMap['rated']!, - descending: descending); + final query = $referenceWithoutCursor.orderBy( + _$MovieFieldMap['rated']!, + descending: descending, + ); var queryCursor = $queryCursor; if (startAtDocument != null) { @@ -2044,7 +2144,7 @@ class _$MovieQuery extends QueryReference queryCursor = queryCursor.copyWith( startAt: [ ...queryCursor.startAt, - _$MoviePerFieldToJson.rated(startAt as String) + _$MoviePerFieldToJson.rated(startAt as String), ], startAtDocumentSnapshot: null, ); @@ -2053,7 +2153,7 @@ class _$MovieQuery extends QueryReference queryCursor = queryCursor.copyWith( startAfter: [ ...queryCursor.startAfter, - _$MoviePerFieldToJson.rated(startAfter as String) + _$MoviePerFieldToJson.rated(startAfter as String), ], startAfterDocumentSnapshot: null, ); @@ -2062,7 +2162,7 @@ class _$MovieQuery extends QueryReference queryCursor = queryCursor.copyWith( endAt: [ ...queryCursor.endAt, - _$MoviePerFieldToJson.rated(endAt as String) + _$MoviePerFieldToJson.rated(endAt as String), ], endAtDocumentSnapshot: null, ); @@ -2071,7 +2171,7 @@ class _$MovieQuery extends QueryReference queryCursor = queryCursor.copyWith( endBefore: [ ...queryCursor.endBefore, - _$MoviePerFieldToJson.rated(endBefore as String) + _$MoviePerFieldToJson.rated(endBefore as String), ], endBeforeDocumentSnapshot: null, ); @@ -2096,8 +2196,10 @@ class _$MovieQuery extends QueryReference MovieDocumentSnapshot? endBeforeDocument, MovieDocumentSnapshot? startAfterDocument, }) { - final query = $referenceWithoutCursor.orderBy(_$MovieFieldMap['genre']!, - descending: descending); + final query = $referenceWithoutCursor.orderBy( + _$MovieFieldMap['genre']!, + descending: descending, + ); var queryCursor = $queryCursor; if (startAtDocument != null) { @@ -2129,7 +2231,7 @@ class _$MovieQuery extends QueryReference queryCursor = queryCursor.copyWith( startAt: [ ...queryCursor.startAt, - _$MoviePerFieldToJson.genre(startAt as List?) + _$MoviePerFieldToJson.genre(startAt as List?), ], startAtDocumentSnapshot: null, ); @@ -2138,7 +2240,7 @@ class _$MovieQuery extends QueryReference queryCursor = queryCursor.copyWith( startAfter: [ ...queryCursor.startAfter, - _$MoviePerFieldToJson.genre(startAfter as List?) + _$MoviePerFieldToJson.genre(startAfter as List?), ], startAfterDocumentSnapshot: null, ); @@ -2147,7 +2249,7 @@ class _$MovieQuery extends QueryReference queryCursor = queryCursor.copyWith( endAt: [ ...queryCursor.endAt, - _$MoviePerFieldToJson.genre(endAt as List?) + _$MoviePerFieldToJson.genre(endAt as List?), ], endAtDocumentSnapshot: null, ); @@ -2156,7 +2258,7 @@ class _$MovieQuery extends QueryReference queryCursor = queryCursor.copyWith( endBefore: [ ...queryCursor.endBefore, - _$MoviePerFieldToJson.genre(endBefore as List?) + _$MoviePerFieldToJson.genre(endBefore as List?), ], endBeforeDocumentSnapshot: null, ); @@ -2181,8 +2283,10 @@ class _$MovieQuery extends QueryReference MovieDocumentSnapshot? endBeforeDocument, MovieDocumentSnapshot? startAfterDocument, }) { - final query = $referenceWithoutCursor.orderBy(_$MovieFieldMap['tags']!, - descending: descending); + final query = $referenceWithoutCursor.orderBy( + _$MovieFieldMap['tags']!, + descending: descending, + ); var queryCursor = $queryCursor; if (startAtDocument != null) { @@ -2214,7 +2318,7 @@ class _$MovieQuery extends QueryReference queryCursor = queryCursor.copyWith( startAt: [ ...queryCursor.startAt, - _$MoviePerFieldToJson.tags(startAt as Set?) + _$MoviePerFieldToJson.tags(startAt as Set?), ], startAtDocumentSnapshot: null, ); @@ -2223,7 +2327,7 @@ class _$MovieQuery extends QueryReference queryCursor = queryCursor.copyWith( startAfter: [ ...queryCursor.startAfter, - _$MoviePerFieldToJson.tags(startAfter as Set?) + _$MoviePerFieldToJson.tags(startAfter as Set?), ], startAfterDocumentSnapshot: null, ); @@ -2232,7 +2336,7 @@ class _$MovieQuery extends QueryReference queryCursor = queryCursor.copyWith( endAt: [ ...queryCursor.endAt, - _$MoviePerFieldToJson.tags(endAt as Set?) + _$MoviePerFieldToJson.tags(endAt as Set?), ], endAtDocumentSnapshot: null, ); @@ -2241,7 +2345,7 @@ class _$MovieQuery extends QueryReference queryCursor = queryCursor.copyWith( endBefore: [ ...queryCursor.endBefore, - _$MoviePerFieldToJson.tags(endBefore as Set?) + _$MoviePerFieldToJson.tags(endBefore as Set?), ], endBeforeDocumentSnapshot: null, ); @@ -2273,9 +2377,7 @@ class MovieDocumentSnapshot extends FirestoreDocumentSnapshot { @override MovieDocumentReference get reference { - return MovieDocumentReference( - snapshot.reference, - ); + return MovieDocumentReference(snapshot.reference); } @override @@ -2284,33 +2386,20 @@ class MovieDocumentSnapshot extends FirestoreDocumentSnapshot { class MovieQuerySnapshot extends FirestoreQuerySnapshot { - MovieQuerySnapshot._( - this.snapshot, - this.docs, - this.docChanges, - ); + MovieQuerySnapshot._(this.snapshot, this.docs, this.docChanges); - factory MovieQuerySnapshot._fromQuerySnapshot( - QuerySnapshot snapshot, - ) { + factory MovieQuerySnapshot._fromQuerySnapshot(QuerySnapshot snapshot) { final docs = snapshot.docs.map(MovieQueryDocumentSnapshot._).toList(); final docChanges = snapshot.docChanges.map((change) { - return _decodeDocumentChange( - change, - MovieDocumentSnapshot._, - ); + return _decodeDocumentChange(change, MovieDocumentSnapshot._); }).toList(); - return MovieQuerySnapshot._( - snapshot, - docs, - docChanges, - ); + return MovieQuerySnapshot._(snapshot, docs, docChanges); } static FirestoreDocumentChange - _decodeDocumentChange( + _decodeDocumentChange( DocumentChange docChange, MovieDocumentSnapshot Function(DocumentSnapshot doc) decodeDoc, ) { @@ -2354,9 +2443,8 @@ abstract class CommentCollectionReference implements CommentQuery, FirestoreCollectionReference { - factory CommentCollectionReference( - DocumentReference parent, - ) = _$CommentCollectionReference; + factory CommentCollectionReference(DocumentReference parent) = + _$CommentCollectionReference; static Comment fromFirestore( DocumentSnapshot> snapshot, @@ -2365,10 +2453,7 @@ abstract class CommentCollectionReference return _$CommentFromJson(snapshot.data()!); } - static Map toFirestore( - Comment value, - SetOptions? options, - ) { + static Map toFirestore(Comment value, SetOptions? options) { return _$CommentToJson(value); } @@ -2388,12 +2473,12 @@ abstract class CommentCollectionReference class _$CommentCollectionReference extends _$CommentQuery implements CommentCollectionReference { - factory _$CommentCollectionReference( - DocumentReference parent, - ) { + factory _$CommentCollectionReference(DocumentReference parent) { return _$CommentCollectionReference._( MovieDocumentReference(parent), - parent.collection('comments').withConverter( + parent + .collection('comments') + .withConverter( fromFirestore: CommentCollectionReference.fromFirestore, toFirestore: CommentCollectionReference.toFirestore, ), @@ -2420,9 +2505,7 @@ class _$CommentCollectionReference extends _$CommentQuery id == null || id.split('/').length == 1, 'The document ID cannot be from a different collection', ); - return CommentDocumentReference( - reference.doc(id), - ); + return CommentDocumentReference(reference.doc(id)); } @override @@ -2589,6 +2672,7 @@ class _$CommentDocumentReference ..._$CommentToJson(model), if (authorNameFieldValue != null) _$CommentFieldMap['authorName']!: authorNameFieldValue, + if (messageFieldValue != null) _$CommentFieldMap['message']!: messageFieldValue, }; @@ -2611,6 +2695,7 @@ class _$CommentDocumentReference ..._$CommentToJson(model), if (authorNameFieldValue != null) _$CommentFieldMap['authorName']!: authorNameFieldValue, + if (messageFieldValue != null) _$CommentFieldMap['message']!: messageFieldValue, }; @@ -2633,6 +2718,7 @@ class _$CommentDocumentReference ..._$CommentToJson(model), if (authorNameFieldValue != null) _$CommentFieldMap['authorName']!: authorNameFieldValue, + if (messageFieldValue != null) _$CommentFieldMap['message']!: messageFieldValue, }; @@ -2660,13 +2746,18 @@ class _$CommentDocumentReference ); final json = { if (authorName != _sentinel) - _$CommentFieldMap['authorName']!: - _$CommentPerFieldToJson.authorName(authorName as String), + _$CommentFieldMap['authorName']!: _$CommentPerFieldToJson.authorName( + authorName as String, + ), + if (authorNameFieldValue != null) _$CommentFieldMap['authorName']!: authorNameFieldValue, + if (message != _sentinel) - _$CommentFieldMap['message']!: - _$CommentPerFieldToJson.message(message as String), + _$CommentFieldMap['message']!: _$CommentPerFieldToJson.message( + message as String, + ), + if (messageFieldValue != null) _$CommentFieldMap['message']!: messageFieldValue, }; @@ -2691,13 +2782,18 @@ class _$CommentDocumentReference ); final json = { if (authorName != _sentinel) - _$CommentFieldMap['authorName']!: - _$CommentPerFieldToJson.authorName(authorName as String), + _$CommentFieldMap['authorName']!: _$CommentPerFieldToJson.authorName( + authorName as String, + ), + if (authorNameFieldValue != null) _$CommentFieldMap['authorName']!: authorNameFieldValue, + if (message != _sentinel) - _$CommentFieldMap['message']!: - _$CommentPerFieldToJson.message(message as String), + _$CommentFieldMap['message']!: _$CommentPerFieldToJson.message( + message as String, + ), + if (messageFieldValue != null) _$CommentFieldMap['message']!: messageFieldValue, }; @@ -2722,13 +2818,18 @@ class _$CommentDocumentReference ); final json = { if (authorName != _sentinel) - _$CommentFieldMap['authorName']!: - _$CommentPerFieldToJson.authorName(authorName as String), + _$CommentFieldMap['authorName']!: _$CommentPerFieldToJson.authorName( + authorName as String, + ), + if (authorNameFieldValue != null) _$CommentFieldMap['authorName']!: authorNameFieldValue, + if (message != _sentinel) - _$CommentFieldMap['message']!: - _$CommentPerFieldToJson.message(message as String), + _$CommentFieldMap['message']!: _$CommentPerFieldToJson.message( + message as String, + ), + if (messageFieldValue != null) _$CommentFieldMap['message']!: messageFieldValue, }; @@ -2901,9 +3002,9 @@ class _$CommentQuery extends QueryReference required Query $referenceWithoutCursor, $QueryCursor $queryCursor = const $QueryCursor(), }) : super( - $referenceWithoutCursor: $referenceWithoutCursor, - $queryCursor: $queryCursor, - ); + $referenceWithoutCursor: $referenceWithoutCursor, + $queryCursor: $queryCursor, + ); final CollectionReference _collection; @@ -2964,7 +3065,8 @@ class _$CommentQuery extends QueryReference arrayContainsAny: arrayContainsAny, whereIn: whereIn, whereNotIn: whereNotIn, - isNull: isNull ?? + isNull: + isNull ?? (isEqualTo == null ? false : null) ?? (isNotEqualTo == null ? true : null), ), @@ -2996,7 +3098,8 @@ class _$CommentQuery extends QueryReference isGreaterThanOrEqualTo: isGreaterThanOrEqualTo, whereIn: whereIn, whereNotIn: whereNotIn, - isNull: isNull ?? + isNull: + isNull ?? (isEqualTo == null ? false : null) ?? (isNotEqualTo == null ? true : null), ), @@ -3036,13 +3139,16 @@ class _$CommentQuery extends QueryReference ? _$CommentPerFieldToJson.authorName(isGreaterThan as String) : null, isGreaterThanOrEqualTo: isGreaterThanOrEqualTo != null - ? _$CommentPerFieldToJson - .authorName(isGreaterThanOrEqualTo as String) + ? _$CommentPerFieldToJson.authorName( + isGreaterThanOrEqualTo as String, + ) : null, whereIn: whereIn?.map((e) => _$CommentPerFieldToJson.authorName(e)), - whereNotIn: - whereNotIn?.map((e) => _$CommentPerFieldToJson.authorName(e)), - isNull: isNull ?? + whereNotIn: whereNotIn?.map( + (e) => _$CommentPerFieldToJson.authorName(e), + ), + isNull: + isNull ?? (isEqualTo == null ? false : null) ?? (isNotEqualTo == null ? true : null), ), @@ -3086,7 +3192,8 @@ class _$CommentQuery extends QueryReference : null, whereIn: whereIn?.map((e) => _$CommentPerFieldToJson.message(e)), whereNotIn: whereNotIn?.map((e) => _$CommentPerFieldToJson.message(e)), - isNull: isNull ?? + isNull: + isNull ?? (isEqualTo == null ? false : null) ?? (isNotEqualTo == null ? true : null), ), @@ -3107,8 +3214,10 @@ class _$CommentQuery extends QueryReference CommentDocumentSnapshot? endBeforeDocument, CommentDocumentSnapshot? startAfterDocument, }) { - final query = - $referenceWithoutCursor.orderBy(fieldPath, descending: descending); + final query = $referenceWithoutCursor.orderBy( + fieldPath, + descending: descending, + ); var queryCursor = $queryCursor; if (startAtDocument != null) { @@ -3180,8 +3289,10 @@ class _$CommentQuery extends QueryReference CommentDocumentSnapshot? endBeforeDocument, CommentDocumentSnapshot? startAfterDocument, }) { - final query = $referenceWithoutCursor.orderBy(FieldPath.documentId, - descending: descending); + final query = $referenceWithoutCursor.orderBy( + FieldPath.documentId, + descending: descending, + ); var queryCursor = $queryCursor; if (startAtDocument != null) { @@ -3253,8 +3364,10 @@ class _$CommentQuery extends QueryReference CommentDocumentSnapshot? endBeforeDocument, CommentDocumentSnapshot? startAfterDocument, }) { - final query = $referenceWithoutCursor - .orderBy(_$CommentFieldMap['authorName']!, descending: descending); + final query = $referenceWithoutCursor.orderBy( + _$CommentFieldMap['authorName']!, + descending: descending, + ); var queryCursor = $queryCursor; if (startAtDocument != null) { @@ -3286,7 +3399,7 @@ class _$CommentQuery extends QueryReference queryCursor = queryCursor.copyWith( startAt: [ ...queryCursor.startAt, - _$CommentPerFieldToJson.authorName(startAt as String) + _$CommentPerFieldToJson.authorName(startAt as String), ], startAtDocumentSnapshot: null, ); @@ -3295,7 +3408,7 @@ class _$CommentQuery extends QueryReference queryCursor = queryCursor.copyWith( startAfter: [ ...queryCursor.startAfter, - _$CommentPerFieldToJson.authorName(startAfter as String) + _$CommentPerFieldToJson.authorName(startAfter as String), ], startAfterDocumentSnapshot: null, ); @@ -3304,7 +3417,7 @@ class _$CommentQuery extends QueryReference queryCursor = queryCursor.copyWith( endAt: [ ...queryCursor.endAt, - _$CommentPerFieldToJson.authorName(endAt as String) + _$CommentPerFieldToJson.authorName(endAt as String), ], endAtDocumentSnapshot: null, ); @@ -3313,7 +3426,7 @@ class _$CommentQuery extends QueryReference queryCursor = queryCursor.copyWith( endBefore: [ ...queryCursor.endBefore, - _$CommentPerFieldToJson.authorName(endBefore as String) + _$CommentPerFieldToJson.authorName(endBefore as String), ], endBeforeDocumentSnapshot: null, ); @@ -3338,8 +3451,10 @@ class _$CommentQuery extends QueryReference CommentDocumentSnapshot? endBeforeDocument, CommentDocumentSnapshot? startAfterDocument, }) { - final query = $referenceWithoutCursor.orderBy(_$CommentFieldMap['message']!, - descending: descending); + final query = $referenceWithoutCursor.orderBy( + _$CommentFieldMap['message']!, + descending: descending, + ); var queryCursor = $queryCursor; if (startAtDocument != null) { @@ -3371,7 +3486,7 @@ class _$CommentQuery extends QueryReference queryCursor = queryCursor.copyWith( startAt: [ ...queryCursor.startAt, - _$CommentPerFieldToJson.message(startAt as String) + _$CommentPerFieldToJson.message(startAt as String), ], startAtDocumentSnapshot: null, ); @@ -3380,7 +3495,7 @@ class _$CommentQuery extends QueryReference queryCursor = queryCursor.copyWith( startAfter: [ ...queryCursor.startAfter, - _$CommentPerFieldToJson.message(startAfter as String) + _$CommentPerFieldToJson.message(startAfter as String), ], startAfterDocumentSnapshot: null, ); @@ -3389,7 +3504,7 @@ class _$CommentQuery extends QueryReference queryCursor = queryCursor.copyWith( endAt: [ ...queryCursor.endAt, - _$CommentPerFieldToJson.message(endAt as String) + _$CommentPerFieldToJson.message(endAt as String), ], endAtDocumentSnapshot: null, ); @@ -3398,7 +3513,7 @@ class _$CommentQuery extends QueryReference queryCursor = queryCursor.copyWith( endBefore: [ ...queryCursor.endBefore, - _$CommentPerFieldToJson.message(endBefore as String) + _$CommentPerFieldToJson.message(endBefore as String), ], endBeforeDocumentSnapshot: null, ); @@ -3430,9 +3545,7 @@ class CommentDocumentSnapshot extends FirestoreDocumentSnapshot { @override CommentDocumentReference get reference { - return CommentDocumentReference( - snapshot.reference, - ); + return CommentDocumentReference(snapshot.reference); } @override @@ -3441,11 +3554,7 @@ class CommentDocumentSnapshot extends FirestoreDocumentSnapshot { class CommentQuerySnapshot extends FirestoreQuerySnapshot { - CommentQuerySnapshot._( - this.snapshot, - this.docs, - this.docChanges, - ); + CommentQuerySnapshot._(this.snapshot, this.docs, this.docChanges); factory CommentQuerySnapshot._fromQuerySnapshot( QuerySnapshot snapshot, @@ -3453,21 +3562,14 @@ class CommentQuerySnapshot final docs = snapshot.docs.map(CommentQueryDocumentSnapshot._).toList(); final docChanges = snapshot.docChanges.map((change) { - return _decodeDocumentChange( - change, - CommentDocumentSnapshot._, - ); + return _decodeDocumentChange(change, CommentDocumentSnapshot._); }).toList(); - return CommentQuerySnapshot._( - snapshot, - docs, - docChanges, - ); + return CommentQuerySnapshot._(snapshot, docs, docChanges); } static FirestoreDocumentChange - _decodeDocumentChange( + _decodeDocumentChange( DocumentChange docChange, CommentDocumentSnapshot Function(DocumentSnapshot doc) decodeDoc, ) { @@ -3519,17 +3621,16 @@ void _$assertMovie(Movie instance) { // ************************************************************************** Movie _$MovieFromJson(Map json) => Movie( - genre: - (json['genre'] as List?)?.map((e) => e as String).toList(), - tags: (json['tags'] as List?)?.map((e) => e as String).toSet(), - likes: (json['likes'] as num).toInt(), - poster: json['poster'] as String, - rated: json['rated'] as String, - runtime: json['runtime'] as String, - title: json['title'] as String, - year: (json['year'] as num).toInt(), - id: json['id'] as String, - ); + genre: (json['genre'] as List?)?.map((e) => e as String).toList(), + tags: (json['tags'] as List?)?.map((e) => e as String).toSet(), + likes: (json['likes'] as num).toInt(), + poster: json['poster'] as String, + rated: json['rated'] as String, + runtime: json['runtime'] as String, + title: json['title'] as String, + year: (json['year'] as num).toInt(), + id: json['id'] as String, +); const _$MovieFieldMap = { 'id': 'id', @@ -3566,21 +3667,21 @@ abstract class _$MoviePerFieldToJson { } Map _$MovieToJson(Movie instance) => { - 'id': instance.id, - 'poster': instance.poster, - 'likes': instance.likes, - 'title': instance.title, - 'year': instance.year, - 'runtime': instance.runtime, - 'rated': instance.rated, - 'genre': instance.genre, - 'tags': instance.tags?.toList(), - }; + 'id': instance.id, + 'poster': instance.poster, + 'likes': instance.likes, + 'title': instance.title, + 'year': instance.year, + 'runtime': instance.runtime, + 'rated': instance.rated, + 'genre': instance.genre, + 'tags': instance.tags?.toList(), +}; Comment _$CommentFromJson(Map json) => Comment( - authorName: json['authorName'] as String, - message: json['message'] as String, - ); + authorName: json['authorName'] as String, + message: json['message'] as String, +); const _$CommentFieldMap = { 'authorName': 'authorName', @@ -3596,6 +3697,6 @@ abstract class _$CommentPerFieldToJson { } Map _$CommentToJson(Comment instance) => { - 'authorName': instance.authorName, - 'message': instance.message, - }; + 'authorName': instance.authorName, + 'message': instance.message, +}; diff --git a/packages/cloud_firestore_odm/example/pubspec.yaml b/packages/cloud_firestore_odm/example/pubspec.yaml index d24240e..729164d 100644 --- a/packages/cloud_firestore_odm/example/pubspec.yaml +++ b/packages/cloud_firestore_odm/example/pubspec.yaml @@ -2,7 +2,7 @@ name: cloud_firestore_odm_example publish_to: none environment: - sdk: ">=3.0.0 <4.0.0" + sdk: ">=3.8.0 <4.0.0" dependencies: cloud_firestore: ^6.0.0 @@ -10,23 +10,23 @@ dependencies: firebase_core: ^4.0.0 flutter: sdk: flutter - freezed_annotation: ^3.0.0 + freezed_annotation: ^3.1.0 json_annotation: ^4.9.0 meta: ^1.12.0 dev_dependencies: - build_runner: ^2.4.2 + build_runner: ^2.7.0 cloud_firestore_odm_generator: path: ../../cloud_firestore_odm_generator cloud_firestore_odm_generator_integration_test: path: ../../cloud_firestore_odm_generator/cloud_firestore_odm_generator_integration_test flutter_test: sdk: flutter - freezed: ^3.0.0 + freezed: ^3.2.0 http: ^1.0.0 integration_test: sdk: flutter - json_serializable: ^6.7.0 + json_serializable: ^6.11.0 mockito: ^5.0.0 dependency_overrides: diff --git a/packages/cloud_firestore_odm/pubspec.yaml b/packages/cloud_firestore_odm/pubspec.yaml index ad66088..9a8edd4 100644 --- a/packages/cloud_firestore_odm/pubspec.yaml +++ b/packages/cloud_firestore_odm/pubspec.yaml @@ -8,7 +8,7 @@ false_secrets: - example/** environment: - sdk: ">=3.0.0 <4.0.0" + sdk: ">=3.8.0 <4.0.0" dependencies: cloud_firestore: ^6.0.0 diff --git a/packages/cloud_firestore_odm_generator/cloud_firestore_odm_generator_integration_test/lib/freezed.dart b/packages/cloud_firestore_odm_generator/cloud_firestore_odm_generator_integration_test/lib/freezed.dart index e8af1d2..e243b7f 100644 --- a/packages/cloud_firestore_odm_generator/cloud_firestore_odm_generator_integration_test/lib/freezed.dart +++ b/packages/cloud_firestore_odm_generator/cloud_firestore_odm_generator_integration_test/lib/freezed.dart @@ -27,25 +27,28 @@ abstract class Person with _$Person { final personRef = PersonCollectionReference(); @Collection('freezed-test') +final publicRedirectedRef = PublicRedirectedCollectionReference(); + @freezed abstract class PublicRedirected with _$PublicRedirected { factory PublicRedirected({required String value}) = PublicRedirected2; - factory PublicRedirected.fromJson(Map json) => - _$PublicRedirectedFromJson(json); + factory PublicRedirected.fromJson(Map json) => _$PublicRedirectedFromJson(json); } /// Freezed 3.x mixed mode /// /// Simple classes -@Collection('freezed-test') @freezed @JsonSerializable() class SimpleFreezed with _$SimpleFreezed { - SimpleFreezed({required this.a}); - final int a; + const SimpleFreezed({required this.a}); + factory SimpleFreezed.fromJson(Map json) => _$SimpleFreezedFromJson(json); - factory SimpleFreezed.fromJson(Map json) => - _$SimpleFreezedFromJson(json); + @override + final int a; Map toJson() => _$SimpleFreezedToJson(this); } + +@Collection('freezed-test') +final simpleFreezedRef = SimpleFreezedCollectionReference(); diff --git a/packages/cloud_firestore_odm_generator/cloud_firestore_odm_generator_integration_test/lib/freezed.freezed.dart b/packages/cloud_firestore_odm_generator/cloud_firestore_odm_generator_integration_test/lib/freezed.freezed.dart index d7f233b..fcfe548 100644 --- a/packages/cloud_firestore_odm_generator/cloud_firestore_odm_generator_integration_test/lib/freezed.freezed.dart +++ b/packages/cloud_firestore_odm_generator/cloud_firestore_odm_generator_integration_test/lib/freezed.freezed.dart @@ -14,406 +14,323 @@ T _$identity(T value) => value; /// @nodoc mixin _$Person { - String get firstName; - @JsonKey(name: 'LAST_NAME') - String get lastName; - @JsonKey(includeFromJson: false, includeToJson: false) - int? get ignored; - - /// Create a copy of Person - /// with the given fields replaced by the non-null parameter values. - @JsonKey(includeFromJson: false, includeToJson: false) - @pragma('vm:prefer-inline') - $PersonCopyWith get copyWith => - _$PersonCopyWithImpl(this as Person, _$identity); + + String get firstName;@JsonKey(name: 'LAST_NAME') String get lastName;@JsonKey(includeFromJson: false, includeToJson: false) int? get ignored; +/// Create a copy of Person +/// with the given fields replaced by the non-null parameter values. +@JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +$PersonCopyWith get copyWith => _$PersonCopyWithImpl(this as Person, _$identity); /// Serializes this Person to a JSON map. Map toJson(); - @override - bool operator ==(Object other) { - return identical(this, other) || - (other.runtimeType == runtimeType && - other is Person && - (identical(other.firstName, firstName) || - other.firstName == firstName) && - (identical(other.lastName, lastName) || - other.lastName == lastName) && - (identical(other.ignored, ignored) || other.ignored == ignored)); - } - @JsonKey(includeFromJson: false, includeToJson: false) - @override - int get hashCode => Object.hash(runtimeType, firstName, lastName, ignored); +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is Person&&(identical(other.firstName, firstName) || other.firstName == firstName)&&(identical(other.lastName, lastName) || other.lastName == lastName)&&(identical(other.ignored, ignored) || other.ignored == ignored)); +} + +@JsonKey(includeFromJson: false, includeToJson: false) +@override +int get hashCode => Object.hash(runtimeType,firstName,lastName,ignored); - @override - String toString() { - return 'Person(firstName: $firstName, lastName: $lastName, ignored: $ignored)'; - } +@override +String toString() { + return 'Person(firstName: $firstName, lastName: $lastName, ignored: $ignored)'; } -/// @nodoc -abstract mixin class $PersonCopyWith<$Res> { - factory $PersonCopyWith(Person value, $Res Function(Person) _then) = - _$PersonCopyWithImpl; - @useResult - $Res call( - {String firstName, - @JsonKey(name: 'LAST_NAME') String lastName, - @JsonKey(includeFromJson: false, includeToJson: false) int? ignored}); + } /// @nodoc -class _$PersonCopyWithImpl<$Res> implements $PersonCopyWith<$Res> { +abstract mixin class $PersonCopyWith<$Res> { + factory $PersonCopyWith(Person value, $Res Function(Person) _then) = _$PersonCopyWithImpl; +@useResult +$Res call({ + String firstName,@JsonKey(name: 'LAST_NAME') String lastName,@JsonKey(includeFromJson: false, includeToJson: false) int? ignored +}); + + + + +} +/// @nodoc +class _$PersonCopyWithImpl<$Res> + implements $PersonCopyWith<$Res> { _$PersonCopyWithImpl(this._self, this._then); final Person _self; final $Res Function(Person) _then; - /// Create a copy of Person - /// with the given fields replaced by the non-null parameter values. - @pragma('vm:prefer-inline') - @override - $Res call({ - Object? firstName = null, - Object? lastName = null, - Object? ignored = freezed, - }) { - return _then(_self.copyWith( - firstName: null == firstName - ? _self.firstName - : firstName // ignore: cast_nullable_to_non_nullable - as String, - lastName: null == lastName - ? _self.lastName - : lastName // ignore: cast_nullable_to_non_nullable - as String, - ignored: freezed == ignored - ? _self.ignored - : ignored // ignore: cast_nullable_to_non_nullable - as int?, - )); - } +/// Create a copy of Person +/// with the given fields replaced by the non-null parameter values. +@pragma('vm:prefer-inline') @override $Res call({Object? firstName = null,Object? lastName = null,Object? ignored = freezed,}) { + return _then(_self.copyWith( +firstName: null == firstName ? _self.firstName : firstName // ignore: cast_nullable_to_non_nullable +as String,lastName: null == lastName ? _self.lastName : lastName // ignore: cast_nullable_to_non_nullable +as String,ignored: freezed == ignored ? _self.ignored : ignored // ignore: cast_nullable_to_non_nullable +as int?, + )); } +} + + /// Adds pattern-matching-related methods to [Person]. extension PersonPatterns on Person { - /// A variant of `map` that fallback to returning `orElse`. - /// - /// It is equivalent to doing: - /// ```dart - /// switch (sealedClass) { - /// case final Subclass value: - /// return ...; - /// case _: - /// return orElse(); - /// } - /// ``` - - @optionalTypeArgs - TResult maybeMap( - TResult Function(_Person value)? $default, { - required TResult orElse(), - }) { - final _that = this; - switch (_that) { - case _Person() when $default != null: - return $default(_that); - case _: - return orElse(); - } - } - - /// A `switch`-like method, using callbacks. - /// - /// Callbacks receives the raw object, upcasted. - /// It is equivalent to doing: - /// ```dart - /// switch (sealedClass) { - /// case final Subclass value: - /// return ...; - /// case final Subclass2 value: - /// return ...; - /// } - /// ``` - - @optionalTypeArgs - TResult map( - TResult Function(_Person value) $default, - ) { - final _that = this; - switch (_that) { - case _Person(): - return $default(_that); - case _: - throw StateError('Unexpected subclass'); - } - } - - /// A variant of `map` that fallback to returning `null`. - /// - /// It is equivalent to doing: - /// ```dart - /// switch (sealedClass) { - /// case final Subclass value: - /// return ...; - /// case _: - /// return null; - /// } - /// ``` - - @optionalTypeArgs - TResult? mapOrNull( - TResult? Function(_Person value)? $default, - ) { - final _that = this; - switch (_that) { - case _Person() when $default != null: - return $default(_that); - case _: - return null; - } - } - - /// A variant of `when` that fallback to an `orElse` callback. - /// - /// It is equivalent to doing: - /// ```dart - /// switch (sealedClass) { - /// case Subclass(:final field): - /// return ...; - /// case _: - /// return orElse(); - /// } - /// ``` - - @optionalTypeArgs - TResult maybeWhen( - TResult Function( - String firstName, - @JsonKey(name: 'LAST_NAME') String lastName, - @JsonKey(includeFromJson: false, includeToJson: false) - int? ignored)? - $default, { - required TResult orElse(), - }) { - final _that = this; - switch (_that) { - case _Person() when $default != null: - return $default(_that.firstName, _that.lastName, _that.ignored); - case _: - return orElse(); - } - } - - /// A `switch`-like method, using callbacks. - /// - /// As opposed to `map`, this offers destructuring. - /// It is equivalent to doing: - /// ```dart - /// switch (sealedClass) { - /// case Subclass(:final field): - /// return ...; - /// case Subclass2(:final field2): - /// return ...; - /// } - /// ``` - - @optionalTypeArgs - TResult when( - TResult Function( - String firstName, - @JsonKey(name: 'LAST_NAME') String lastName, - @JsonKey(includeFromJson: false, includeToJson: false) int? ignored) - $default, - ) { - final _that = this; - switch (_that) { - case _Person(): - return $default(_that.firstName, _that.lastName, _that.ignored); - case _: - throw StateError('Unexpected subclass'); - } - } - - /// A variant of `when` that fallback to returning `null` - /// - /// It is equivalent to doing: - /// ```dart - /// switch (sealedClass) { - /// case Subclass(:final field): - /// return ...; - /// case _: - /// return null; - /// } - /// ``` - - @optionalTypeArgs - TResult? whenOrNull( - TResult? Function( - String firstName, - @JsonKey(name: 'LAST_NAME') String lastName, - @JsonKey(includeFromJson: false, includeToJson: false) - int? ignored)? - $default, - ) { - final _that = this; - switch (_that) { - case _Person() when $default != null: - return $default(_that.firstName, _that.lastName, _that.ignored); - case _: - return null; - } - } +/// A variant of `map` that fallback to returning `orElse`. +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case final Subclass value: +/// return ...; +/// case _: +/// return orElse(); +/// } +/// ``` + +@optionalTypeArgs TResult maybeMap(TResult Function( _Person value)? $default,{required TResult orElse(),}){ +final _that = this; +switch (_that) { +case _Person() when $default != null: +return $default(_that);case _: + return orElse(); + +} +} +/// A `switch`-like method, using callbacks. +/// +/// Callbacks receives the raw object, upcasted. +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case final Subclass value: +/// return ...; +/// case final Subclass2 value: +/// return ...; +/// } +/// ``` + +@optionalTypeArgs TResult map(TResult Function( _Person value) $default,){ +final _that = this; +switch (_that) { +case _Person(): +return $default(_that);case _: + throw StateError('Unexpected subclass'); + +} +} +/// A variant of `map` that fallback to returning `null`. +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case final Subclass value: +/// return ...; +/// case _: +/// return null; +/// } +/// ``` + +@optionalTypeArgs TResult? mapOrNull(TResult? Function( _Person value)? $default,){ +final _that = this; +switch (_that) { +case _Person() when $default != null: +return $default(_that);case _: + return null; + +} +} +/// A variant of `when` that fallback to an `orElse` callback. +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case Subclass(:final field): +/// return ...; +/// case _: +/// return orElse(); +/// } +/// ``` + +@optionalTypeArgs TResult maybeWhen(TResult Function( String firstName, @JsonKey(name: 'LAST_NAME') String lastName, @JsonKey(includeFromJson: false, includeToJson: false) int? ignored)? $default,{required TResult orElse(),}) {final _that = this; +switch (_that) { +case _Person() when $default != null: +return $default(_that.firstName,_that.lastName,_that.ignored);case _: + return orElse(); + +} +} +/// A `switch`-like method, using callbacks. +/// +/// As opposed to `map`, this offers destructuring. +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case Subclass(:final field): +/// return ...; +/// case Subclass2(:final field2): +/// return ...; +/// } +/// ``` + +@optionalTypeArgs TResult when(TResult Function( String firstName, @JsonKey(name: 'LAST_NAME') String lastName, @JsonKey(includeFromJson: false, includeToJson: false) int? ignored) $default,) {final _that = this; +switch (_that) { +case _Person(): +return $default(_that.firstName,_that.lastName,_that.ignored);case _: + throw StateError('Unexpected subclass'); + +} +} +/// A variant of `when` that fallback to returning `null` +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case Subclass(:final field): +/// return ...; +/// case _: +/// return null; +/// } +/// ``` + +@optionalTypeArgs TResult? whenOrNull(TResult? Function( String firstName, @JsonKey(name: 'LAST_NAME') String lastName, @JsonKey(includeFromJson: false, includeToJson: false) int? ignored)? $default,) {final _that = this; +switch (_that) { +case _Person() when $default != null: +return $default(_that.firstName,_that.lastName,_that.ignored);case _: + return null; + +} +} + } /// @nodoc @JsonSerializable(fieldRename: FieldRename.snake) class _Person implements Person { - _Person( - {required this.firstName, - @JsonKey(name: 'LAST_NAME') required this.lastName, - @JsonKey(includeFromJson: false, includeToJson: false) this.ignored}); + _Person({required this.firstName, @JsonKey(name: 'LAST_NAME') required this.lastName, @JsonKey(includeFromJson: false, includeToJson: false) this.ignored}); factory _Person.fromJson(Map json) => _$PersonFromJson(json); - @override - final String firstName; - @override - @JsonKey(name: 'LAST_NAME') - final String lastName; - @override - @JsonKey(includeFromJson: false, includeToJson: false) - final int? ignored; - - /// Create a copy of Person - /// with the given fields replaced by the non-null parameter values. - @override - @JsonKey(includeFromJson: false, includeToJson: false) - @pragma('vm:prefer-inline') - _$PersonCopyWith<_Person> get copyWith => - __$PersonCopyWithImpl<_Person>(this, _$identity); - - @override - Map toJson() { - return _$PersonToJson( - this, - ); - } - - @override - bool operator ==(Object other) { - return identical(this, other) || - (other.runtimeType == runtimeType && - other is _Person && - (identical(other.firstName, firstName) || - other.firstName == firstName) && - (identical(other.lastName, lastName) || - other.lastName == lastName) && - (identical(other.ignored, ignored) || other.ignored == ignored)); - } - - @JsonKey(includeFromJson: false, includeToJson: false) - @override - int get hashCode => Object.hash(runtimeType, firstName, lastName, ignored); - - @override - String toString() { - return 'Person(firstName: $firstName, lastName: $lastName, ignored: $ignored)'; - } +@override final String firstName; +@override@JsonKey(name: 'LAST_NAME') final String lastName; +@override@JsonKey(includeFromJson: false, includeToJson: false) final int? ignored; + +/// Create a copy of Person +/// with the given fields replaced by the non-null parameter values. +@override @JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +_$PersonCopyWith<_Person> get copyWith => __$PersonCopyWithImpl<_Person>(this, _$identity); + +@override +Map toJson() { + return _$PersonToJson(this, ); +} + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is _Person&&(identical(other.firstName, firstName) || other.firstName == firstName)&&(identical(other.lastName, lastName) || other.lastName == lastName)&&(identical(other.ignored, ignored) || other.ignored == ignored)); +} + +@JsonKey(includeFromJson: false, includeToJson: false) +@override +int get hashCode => Object.hash(runtimeType,firstName,lastName,ignored); + +@override +String toString() { + return 'Person(firstName: $firstName, lastName: $lastName, ignored: $ignored)'; +} + + } /// @nodoc abstract mixin class _$PersonCopyWith<$Res> implements $PersonCopyWith<$Res> { - factory _$PersonCopyWith(_Person value, $Res Function(_Person) _then) = - __$PersonCopyWithImpl; - @override - @useResult - $Res call( - {String firstName, - @JsonKey(name: 'LAST_NAME') String lastName, - @JsonKey(includeFromJson: false, includeToJson: false) int? ignored}); -} + factory _$PersonCopyWith(_Person value, $Res Function(_Person) _then) = __$PersonCopyWithImpl; +@override @useResult +$Res call({ + String firstName,@JsonKey(name: 'LAST_NAME') String lastName,@JsonKey(includeFromJson: false, includeToJson: false) int? ignored +}); + + + +} /// @nodoc -class __$PersonCopyWithImpl<$Res> implements _$PersonCopyWith<$Res> { +class __$PersonCopyWithImpl<$Res> + implements _$PersonCopyWith<$Res> { __$PersonCopyWithImpl(this._self, this._then); final _Person _self; final $Res Function(_Person) _then; - /// Create a copy of Person - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $Res call({ - Object? firstName = null, - Object? lastName = null, - Object? ignored = freezed, - }) { - return _then(_Person( - firstName: null == firstName - ? _self.firstName - : firstName // ignore: cast_nullable_to_non_nullable - as String, - lastName: null == lastName - ? _self.lastName - : lastName // ignore: cast_nullable_to_non_nullable - as String, - ignored: freezed == ignored - ? _self.ignored - : ignored // ignore: cast_nullable_to_non_nullable - as int?, - )); - } -} - -PublicRedirected _$PublicRedirectedFromJson(Map json) { - return PublicRedirected2.fromJson(json); +/// Create a copy of Person +/// with the given fields replaced by the non-null parameter values. +@override @pragma('vm:prefer-inline') $Res call({Object? firstName = null,Object? lastName = null,Object? ignored = freezed,}) { + return _then(_Person( +firstName: null == firstName ? _self.firstName : firstName // ignore: cast_nullable_to_non_nullable +as String,lastName: null == lastName ? _self.lastName : lastName // ignore: cast_nullable_to_non_nullable +as String,ignored: freezed == ignored ? _self.ignored : ignored // ignore: cast_nullable_to_non_nullable +as int?, + )); +} + + +} + +PublicRedirected _$PublicRedirectedFromJson( + Map json +) { + return PublicRedirected2.fromJson( + json + ); } /// @nodoc mixin _$PublicRedirected { - String get value; - /// Create a copy of PublicRedirected - /// with the given fields replaced by the non-null parameter values. - @JsonKey(includeFromJson: false, includeToJson: false) - @pragma('vm:prefer-inline') - $PublicRedirectedCopyWith get copyWith => - _$PublicRedirectedCopyWithImpl( - this as PublicRedirected, _$identity); + String get value; +/// Create a copy of PublicRedirected +/// with the given fields replaced by the non-null parameter values. +@JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +$PublicRedirectedCopyWith get copyWith => _$PublicRedirectedCopyWithImpl(this as PublicRedirected, _$identity); /// Serializes this PublicRedirected to a JSON map. Map toJson(); - @override - bool operator ==(Object other) { - return identical(this, other) || - (other.runtimeType == runtimeType && - other is PublicRedirected && - (identical(other.value, value) || other.value == value)); - } - @JsonKey(includeFromJson: false, includeToJson: false) - @override - int get hashCode => Object.hash(runtimeType, value); +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is PublicRedirected&&(identical(other.value, value) || other.value == value)); +} + +@JsonKey(includeFromJson: false, includeToJson: false) +@override +int get hashCode => Object.hash(runtimeType,value); - @override - String toString() { - return 'PublicRedirected(value: $value)'; - } +@override +String toString() { + return 'PublicRedirected(value: $value)'; } -/// @nodoc -abstract mixin class $PublicRedirectedCopyWith<$Res> { - factory $PublicRedirectedCopyWith( - PublicRedirected value, $Res Function(PublicRedirected) _then) = - _$PublicRedirectedCopyWithImpl; - @useResult - $Res call({String value}); + } +/// @nodoc +abstract mixin class $PublicRedirectedCopyWith<$Res> { + factory $PublicRedirectedCopyWith(PublicRedirected value, $Res Function(PublicRedirected) _then) = _$PublicRedirectedCopyWithImpl; +@useResult +$Res call({ + String value +}); + + + + +} /// @nodoc class _$PublicRedirectedCopyWithImpl<$Res> implements $PublicRedirectedCopyWith<$Res> { @@ -422,233 +339,197 @@ class _$PublicRedirectedCopyWithImpl<$Res> final PublicRedirected _self; final $Res Function(PublicRedirected) _then; - /// Create a copy of PublicRedirected - /// with the given fields replaced by the non-null parameter values. - @pragma('vm:prefer-inline') - @override - $Res call({ - Object? value = null, - }) { - return _then(_self.copyWith( - value: null == value - ? _self.value - : value // ignore: cast_nullable_to_non_nullable - as String, - )); - } +/// Create a copy of PublicRedirected +/// with the given fields replaced by the non-null parameter values. +@pragma('vm:prefer-inline') @override $Res call({Object? value = null,}) { + return _then(_self.copyWith( +value: null == value ? _self.value : value // ignore: cast_nullable_to_non_nullable +as String, + )); } +} + + /// Adds pattern-matching-related methods to [PublicRedirected]. extension PublicRedirectedPatterns on PublicRedirected { - /// A variant of `map` that fallback to returning `orElse`. - /// - /// It is equivalent to doing: - /// ```dart - /// switch (sealedClass) { - /// case final Subclass value: - /// return ...; - /// case _: - /// return orElse(); - /// } - /// ``` - - @optionalTypeArgs - TResult maybeMap( - TResult Function(PublicRedirected2 value)? $default, { - required TResult orElse(), - }) { - final _that = this; - switch (_that) { - case PublicRedirected2() when $default != null: - return $default(_that); - case _: - return orElse(); - } - } - - /// A `switch`-like method, using callbacks. - /// - /// Callbacks receives the raw object, upcasted. - /// It is equivalent to doing: - /// ```dart - /// switch (sealedClass) { - /// case final Subclass value: - /// return ...; - /// case final Subclass2 value: - /// return ...; - /// } - /// ``` - - @optionalTypeArgs - TResult map( - TResult Function(PublicRedirected2 value) $default, - ) { - final _that = this; - switch (_that) { - case PublicRedirected2(): - return $default(_that); - case _: - throw StateError('Unexpected subclass'); - } - } - - /// A variant of `map` that fallback to returning `null`. - /// - /// It is equivalent to doing: - /// ```dart - /// switch (sealedClass) { - /// case final Subclass value: - /// return ...; - /// case _: - /// return null; - /// } - /// ``` - - @optionalTypeArgs - TResult? mapOrNull( - TResult? Function(PublicRedirected2 value)? $default, - ) { - final _that = this; - switch (_that) { - case PublicRedirected2() when $default != null: - return $default(_that); - case _: - return null; - } - } - - /// A variant of `when` that fallback to an `orElse` callback. - /// - /// It is equivalent to doing: - /// ```dart - /// switch (sealedClass) { - /// case Subclass(:final field): - /// return ...; - /// case _: - /// return orElse(); - /// } - /// ``` - - @optionalTypeArgs - TResult maybeWhen( - TResult Function(String value)? $default, { - required TResult orElse(), - }) { - final _that = this; - switch (_that) { - case PublicRedirected2() when $default != null: - return $default(_that.value); - case _: - return orElse(); - } - } - - /// A `switch`-like method, using callbacks. - /// - /// As opposed to `map`, this offers destructuring. - /// It is equivalent to doing: - /// ```dart - /// switch (sealedClass) { - /// case Subclass(:final field): - /// return ...; - /// case Subclass2(:final field2): - /// return ...; - /// } - /// ``` - - @optionalTypeArgs - TResult when( - TResult Function(String value) $default, - ) { - final _that = this; - switch (_that) { - case PublicRedirected2(): - return $default(_that.value); - case _: - throw StateError('Unexpected subclass'); - } - } - - /// A variant of `when` that fallback to returning `null` - /// - /// It is equivalent to doing: - /// ```dart - /// switch (sealedClass) { - /// case Subclass(:final field): - /// return ...; - /// case _: - /// return null; - /// } - /// ``` - - @optionalTypeArgs - TResult? whenOrNull( - TResult? Function(String value)? $default, - ) { - final _that = this; - switch (_that) { - case PublicRedirected2() when $default != null: - return $default(_that.value); - case _: - return null; - } - } +/// A variant of `map` that fallback to returning `orElse`. +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case final Subclass value: +/// return ...; +/// case _: +/// return orElse(); +/// } +/// ``` + +@optionalTypeArgs TResult maybeMap(TResult Function( PublicRedirected2 value)? $default,{required TResult orElse(),}){ +final _that = this; +switch (_that) { +case PublicRedirected2() when $default != null: +return $default(_that);case _: + return orElse(); + +} +} +/// A `switch`-like method, using callbacks. +/// +/// Callbacks receives the raw object, upcasted. +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case final Subclass value: +/// return ...; +/// case final Subclass2 value: +/// return ...; +/// } +/// ``` + +@optionalTypeArgs TResult map(TResult Function( PublicRedirected2 value) $default,){ +final _that = this; +switch (_that) { +case PublicRedirected2(): +return $default(_that);case _: + throw StateError('Unexpected subclass'); + +} +} +/// A variant of `map` that fallback to returning `null`. +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case final Subclass value: +/// return ...; +/// case _: +/// return null; +/// } +/// ``` + +@optionalTypeArgs TResult? mapOrNull(TResult? Function( PublicRedirected2 value)? $default,){ +final _that = this; +switch (_that) { +case PublicRedirected2() when $default != null: +return $default(_that);case _: + return null; + +} +} +/// A variant of `when` that fallback to an `orElse` callback. +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case Subclass(:final field): +/// return ...; +/// case _: +/// return orElse(); +/// } +/// ``` + +@optionalTypeArgs TResult maybeWhen(TResult Function( String value)? $default,{required TResult orElse(),}) {final _that = this; +switch (_that) { +case PublicRedirected2() when $default != null: +return $default(_that.value);case _: + return orElse(); + +} +} +/// A `switch`-like method, using callbacks. +/// +/// As opposed to `map`, this offers destructuring. +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case Subclass(:final field): +/// return ...; +/// case Subclass2(:final field2): +/// return ...; +/// } +/// ``` + +@optionalTypeArgs TResult when(TResult Function( String value) $default,) {final _that = this; +switch (_that) { +case PublicRedirected2(): +return $default(_that.value);case _: + throw StateError('Unexpected subclass'); + +} +} +/// A variant of `when` that fallback to returning `null` +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case Subclass(:final field): +/// return ...; +/// case _: +/// return null; +/// } +/// ``` + +@optionalTypeArgs TResult? whenOrNull(TResult? Function( String value)? $default,) {final _that = this; +switch (_that) { +case PublicRedirected2() when $default != null: +return $default(_that.value);case _: + return null; + +} +} + } /// @nodoc @JsonSerializable() + class PublicRedirected2 implements PublicRedirected { - PublicRedirected2({required this.value}); - factory PublicRedirected2.fromJson(Map json) => - _$PublicRedirected2FromJson(json); - - @override - final String value; - - /// Create a copy of PublicRedirected - /// with the given fields replaced by the non-null parameter values. - @override - @JsonKey(includeFromJson: false, includeToJson: false) - @pragma('vm:prefer-inline') - $PublicRedirected2CopyWith get copyWith => - _$PublicRedirected2CopyWithImpl(this, _$identity); - - @override - Map toJson() { - return _$PublicRedirected2ToJson( - this, - ); - } + PublicRedirected2({required this.value}); + factory PublicRedirected2.fromJson(Map json) => _$PublicRedirected2FromJson(json); - @override - bool operator ==(Object other) { - return identical(this, other) || - (other.runtimeType == runtimeType && - other is PublicRedirected2 && - (identical(other.value, value) || other.value == value)); - } +@override final String value; - @JsonKey(includeFromJson: false, includeToJson: false) - @override - int get hashCode => Object.hash(runtimeType, value); +/// Create a copy of PublicRedirected +/// with the given fields replaced by the non-null parameter values. +@override @JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +$PublicRedirected2CopyWith get copyWith => _$PublicRedirected2CopyWithImpl(this, _$identity); - @override - String toString() { - return 'PublicRedirected(value: $value)'; - } +@override +Map toJson() { + return _$PublicRedirected2ToJson(this, ); } -/// @nodoc -abstract mixin class $PublicRedirected2CopyWith<$Res> - implements $PublicRedirectedCopyWith<$Res> { - factory $PublicRedirected2CopyWith( - PublicRedirected2 value, $Res Function(PublicRedirected2) _then) = - _$PublicRedirected2CopyWithImpl; - @override - @useResult - $Res call({String value}); +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is PublicRedirected2&&(identical(other.value, value) || other.value == value)); } +@JsonKey(includeFromJson: false, includeToJson: false) +@override +int get hashCode => Object.hash(runtimeType,value); + +@override +String toString() { + return 'PublicRedirected(value: $value)'; +} + + +} + +/// @nodoc +abstract mixin class $PublicRedirected2CopyWith<$Res> implements $PublicRedirectedCopyWith<$Res> { + factory $PublicRedirected2CopyWith(PublicRedirected2 value, $Res Function(PublicRedirected2) _then) = _$PublicRedirected2CopyWithImpl; +@override @useResult +$Res call({ + String value +}); + + + + +} /// @nodoc class _$PublicRedirected2CopyWithImpl<$Res> implements $PublicRedirected2CopyWith<$Res> { @@ -657,61 +538,60 @@ class _$PublicRedirected2CopyWithImpl<$Res> final PublicRedirected2 _self; final $Res Function(PublicRedirected2) _then; - /// Create a copy of PublicRedirected - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $Res call({ - Object? value = null, - }) { - return _then(PublicRedirected2( - value: null == value - ? _self.value - : value // ignore: cast_nullable_to_non_nullable - as String, - )); - } +/// Create a copy of PublicRedirected +/// with the given fields replaced by the non-null parameter values. +@override @pragma('vm:prefer-inline') $Res call({Object? value = null,}) { + return _then(PublicRedirected2( +value: null == value ? _self.value : value // ignore: cast_nullable_to_non_nullable +as String, + )); } + +} + + /// @nodoc mixin _$SimpleFreezed { - int get a; - - /// Create a copy of SimpleFreezed - /// with the given fields replaced by the non-null parameter values. - @JsonKey(includeFromJson: false, includeToJson: false) - @pragma('vm:prefer-inline') - $SimpleFreezedCopyWith get copyWith => - _$SimpleFreezedCopyWithImpl( - this as SimpleFreezed, _$identity); - - @override - bool operator ==(Object other) { - return identical(this, other) || - (other.runtimeType == runtimeType && - other is SimpleFreezed && - (identical(other.a, a) || other.a == a)); - } - - @JsonKey(includeFromJson: false, includeToJson: false) - @override - int get hashCode => Object.hash(runtimeType, a); - - @override - String toString() { - return 'SimpleFreezed(a: $a)'; - } + + int get a; +/// Create a copy of SimpleFreezed +/// with the given fields replaced by the non-null parameter values. +@JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +$SimpleFreezedCopyWith get copyWith => _$SimpleFreezedCopyWithImpl(this as SimpleFreezed, _$identity); + + + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is SimpleFreezed&&(identical(other.a, a) || other.a == a)); } -/// @nodoc -abstract mixin class $SimpleFreezedCopyWith<$Res> { - factory $SimpleFreezedCopyWith( - SimpleFreezed value, $Res Function(SimpleFreezed) _then) = - _$SimpleFreezedCopyWithImpl; - @useResult - $Res call({int a}); +@JsonKey(includeFromJson: false, includeToJson: false) +@override +int get hashCode => Object.hash(runtimeType,a); + +@override +String toString() { + return 'SimpleFreezed(a: $a)'; } + +} + +/// @nodoc +abstract mixin class $SimpleFreezedCopyWith<$Res> { + factory $SimpleFreezedCopyWith(SimpleFreezed value, $Res Function(SimpleFreezed) _then) = _$SimpleFreezedCopyWithImpl; +@useResult +$Res call({ + int a +}); + + + + +} /// @nodoc class _$SimpleFreezedCopyWithImpl<$Res> implements $SimpleFreezedCopyWith<$Res> { @@ -720,155 +600,140 @@ class _$SimpleFreezedCopyWithImpl<$Res> final SimpleFreezed _self; final $Res Function(SimpleFreezed) _then; - /// Create a copy of SimpleFreezed - /// with the given fields replaced by the non-null parameter values. - @pragma('vm:prefer-inline') - @override - $Res call({ - Object? a = null, - }) { - return _then(SimpleFreezed( - a: null == a - ? _self.a - : a // ignore: cast_nullable_to_non_nullable - as int, - )); - } +/// Create a copy of SimpleFreezed +/// with the given fields replaced by the non-null parameter values. +@pragma('vm:prefer-inline') @override $Res call({Object? a = null,}) { + return _then(SimpleFreezed( +a: null == a ? _self.a : a // ignore: cast_nullable_to_non_nullable +as int, + )); } +} + + /// Adds pattern-matching-related methods to [SimpleFreezed]. extension SimpleFreezedPatterns on SimpleFreezed { - /// A variant of `map` that fallback to returning `orElse`. - /// - /// It is equivalent to doing: - /// ```dart - /// switch (sealedClass) { - /// case final Subclass value: - /// return ...; - /// case _: - /// return orElse(); - /// } - /// ``` - - @optionalTypeArgs - TResult maybeMap({ - required TResult orElse(), - }) { - final _that = this; - switch (_that) { - case _: - return orElse(); - } - } - - /// A `switch`-like method, using callbacks. - /// - /// Callbacks receives the raw object, upcasted. - /// It is equivalent to doing: - /// ```dart - /// switch (sealedClass) { - /// case final Subclass value: - /// return ...; - /// case final Subclass2 value: - /// return ...; - /// } - /// ``` - - @optionalTypeArgs - TResult map() { - final _that = this; - switch (_that) { - case _: - throw StateError('Unexpected subclass'); - } - } - - /// A variant of `map` that fallback to returning `null`. - /// - /// It is equivalent to doing: - /// ```dart - /// switch (sealedClass) { - /// case final Subclass value: - /// return ...; - /// case _: - /// return null; - /// } - /// ``` - - @optionalTypeArgs - TResult? mapOrNull() { - final _that = this; - switch (_that) { - case _: - return null; - } - } - - /// A variant of `when` that fallback to an `orElse` callback. - /// - /// It is equivalent to doing: - /// ```dart - /// switch (sealedClass) { - /// case Subclass(:final field): - /// return ...; - /// case _: - /// return orElse(); - /// } - /// ``` - - @optionalTypeArgs - TResult maybeWhen({ - required TResult orElse(), - }) { - final _that = this; - switch (_that) { - case _: - return orElse(); - } - } - - /// A `switch`-like method, using callbacks. - /// - /// As opposed to `map`, this offers destructuring. - /// It is equivalent to doing: - /// ```dart - /// switch (sealedClass) { - /// case Subclass(:final field): - /// return ...; - /// case Subclass2(:final field2): - /// return ...; - /// } - /// ``` - - @optionalTypeArgs - TResult when() { - final _that = this; - switch (_that) { - case _: - throw StateError('Unexpected subclass'); - } - } - - /// A variant of `when` that fallback to returning `null` - /// - /// It is equivalent to doing: - /// ```dart - /// switch (sealedClass) { - /// case Subclass(:final field): - /// return ...; - /// case _: - /// return null; - /// } - /// ``` - - @optionalTypeArgs - TResult? whenOrNull() { - final _that = this; - switch (_that) { - case _: - return null; - } - } +/// A variant of `map` that fallback to returning `orElse`. +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case final Subclass value: +/// return ...; +/// case _: +/// return orElse(); +/// } +/// ``` + +@optionalTypeArgs TResult maybeMap({required TResult orElse(),}){ +final _that = this; +switch (_that) { +case _: + return orElse(); + +} +} +/// A `switch`-like method, using callbacks. +/// +/// Callbacks receives the raw object, upcasted. +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case final Subclass value: +/// return ...; +/// case final Subclass2 value: +/// return ...; +/// } +/// ``` + +@optionalTypeArgs TResult map(){ +final _that = this; +switch (_that) { +case _: + throw StateError('Unexpected subclass'); + +} +} +/// A variant of `map` that fallback to returning `null`. +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case final Subclass value: +/// return ...; +/// case _: +/// return null; +/// } +/// ``` + +@optionalTypeArgs TResult? mapOrNull(){ +final _that = this; +switch (_that) { +case _: + return null; + +} +} +/// A variant of `when` that fallback to an `orElse` callback. +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case Subclass(:final field): +/// return ...; +/// case _: +/// return orElse(); +/// } +/// ``` + +@optionalTypeArgs TResult maybeWhen({required TResult orElse(),}) {final _that = this; +switch (_that) { +case _: + return orElse(); + +} +} +/// A `switch`-like method, using callbacks. +/// +/// As opposed to `map`, this offers destructuring. +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case Subclass(:final field): +/// return ...; +/// case Subclass2(:final field2): +/// return ...; +/// } +/// ``` + +@optionalTypeArgs TResult when() {final _that = this; +switch (_that) { +case _: + throw StateError('Unexpected subclass'); + +} +} +/// A variant of `when` that fallback to returning `null` +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case Subclass(:final field): +/// return ...; +/// case _: +/// return null; +/// } +/// ``` + +@optionalTypeArgs TResult? whenOrNull() {final _that = this; +switch (_that) { +case _: + return null; + +} +} + } // dart format on diff --git a/packages/cloud_firestore_odm_generator/cloud_firestore_odm_generator_integration_test/lib/freezed.g.dart b/packages/cloud_firestore_odm_generator/cloud_firestore_odm_generator_integration_test/lib/freezed.g.dart index 85a3fa1..a3f0e99 100644 --- a/packages/cloud_firestore_odm_generator/cloud_firestore_odm_generator_integration_test/lib/freezed.g.dart +++ b/packages/cloud_firestore_odm_generator/cloud_firestore_odm_generator_integration_test/lib/freezed.g.dart @@ -24,9 +24,8 @@ abstract class PersonCollectionReference implements PersonQuery, FirestoreCollectionReference { - factory PersonCollectionReference([ - FirebaseFirestore? firestore, - ]) = _$PersonCollectionReference; + factory PersonCollectionReference([FirebaseFirestore? firestore]) = + _$PersonCollectionReference; static Person fromFirestore( DocumentSnapshot> snapshot, @@ -35,10 +34,7 @@ abstract class PersonCollectionReference return Person.fromJson(snapshot.data()!); } - static Map toFirestore( - Person value, - SetOptions? options, - ) { + static Map toFirestore(Person value, SetOptions? options) { return value.toJson(); } @@ -59,16 +55,17 @@ class _$PersonCollectionReference extends _$PersonQuery firestore ??= FirebaseFirestore.instance; return _$PersonCollectionReference._( - firestore.collection('freezed-test').withConverter( + firestore + .collection('freezed-test') + .withConverter( fromFirestore: PersonCollectionReference.fromFirestore, toFirestore: PersonCollectionReference.toFirestore, ), ); } - _$PersonCollectionReference._( - CollectionReference reference, - ) : super(reference, $referenceWithoutCursor: reference); + _$PersonCollectionReference._(CollectionReference reference) + : super(reference, $referenceWithoutCursor: reference); String get path => reference.path; @@ -82,9 +79,7 @@ class _$PersonCollectionReference extends _$PersonQuery id == null || id.split('/').length == 1, 'The document ID cannot be from a different collection', ); - return PersonDocumentReference( - reference.doc(id), - ); + return PersonDocumentReference(reference.doc(id)); } @override @@ -241,6 +236,7 @@ class _$PersonDocumentReference ...model.toJson(), if (firstNameFieldValue != null) _$PersonFieldMap['firstName']!: firstNameFieldValue, + if (lastNameFieldValue != null) _$PersonFieldMap['lastName']!: lastNameFieldValue, }; @@ -263,6 +259,7 @@ class _$PersonDocumentReference ...model.toJson(), if (firstNameFieldValue != null) _$PersonFieldMap['firstName']!: firstNameFieldValue, + if (lastNameFieldValue != null) _$PersonFieldMap['lastName']!: lastNameFieldValue, }; @@ -285,6 +282,7 @@ class _$PersonDocumentReference ...model.toJson(), if (firstNameFieldValue != null) _$PersonFieldMap['firstName']!: firstNameFieldValue, + if (lastNameFieldValue != null) _$PersonFieldMap['lastName']!: lastNameFieldValue, }; @@ -312,13 +310,18 @@ class _$PersonDocumentReference ); final json = { if (firstName != _sentinel) - _$PersonFieldMap['firstName']!: - _$PersonPerFieldToJson.firstName(firstName as String), + _$PersonFieldMap['firstName']!: _$PersonPerFieldToJson.firstName( + firstName as String, + ), + if (firstNameFieldValue != null) _$PersonFieldMap['firstName']!: firstNameFieldValue, + if (lastName != _sentinel) - _$PersonFieldMap['lastName']!: - _$PersonPerFieldToJson.lastName(lastName as String), + _$PersonFieldMap['lastName']!: _$PersonPerFieldToJson.lastName( + lastName as String, + ), + if (lastNameFieldValue != null) _$PersonFieldMap['lastName']!: lastNameFieldValue, }; @@ -343,13 +346,18 @@ class _$PersonDocumentReference ); final json = { if (firstName != _sentinel) - _$PersonFieldMap['firstName']!: - _$PersonPerFieldToJson.firstName(firstName as String), + _$PersonFieldMap['firstName']!: _$PersonPerFieldToJson.firstName( + firstName as String, + ), + if (firstNameFieldValue != null) _$PersonFieldMap['firstName']!: firstNameFieldValue, + if (lastName != _sentinel) - _$PersonFieldMap['lastName']!: - _$PersonPerFieldToJson.lastName(lastName as String), + _$PersonFieldMap['lastName']!: _$PersonPerFieldToJson.lastName( + lastName as String, + ), + if (lastNameFieldValue != null) _$PersonFieldMap['lastName']!: lastNameFieldValue, }; @@ -374,13 +382,18 @@ class _$PersonDocumentReference ); final json = { if (firstName != _sentinel) - _$PersonFieldMap['firstName']!: - _$PersonPerFieldToJson.firstName(firstName as String), + _$PersonFieldMap['firstName']!: _$PersonPerFieldToJson.firstName( + firstName as String, + ), + if (firstNameFieldValue != null) _$PersonFieldMap['firstName']!: firstNameFieldValue, + if (lastName != _sentinel) - _$PersonFieldMap['lastName']!: - _$PersonPerFieldToJson.lastName(lastName as String), + _$PersonFieldMap['lastName']!: _$PersonPerFieldToJson.lastName( + lastName as String, + ), + if (lastNameFieldValue != null) _$PersonFieldMap['lastName']!: lastNameFieldValue, }; @@ -553,9 +566,9 @@ class _$PersonQuery extends QueryReference required Query $referenceWithoutCursor, $QueryCursor $queryCursor = const $QueryCursor(), }) : super( - $referenceWithoutCursor: $referenceWithoutCursor, - $queryCursor: $queryCursor, - ); + $referenceWithoutCursor: $referenceWithoutCursor, + $queryCursor: $queryCursor, + ); final CollectionReference _collection; @@ -616,7 +629,8 @@ class _$PersonQuery extends QueryReference arrayContainsAny: arrayContainsAny, whereIn: whereIn, whereNotIn: whereNotIn, - isNull: isNull ?? + isNull: + isNull ?? (isEqualTo == null ? false : null) ?? (isNotEqualTo == null ? true : null), ), @@ -648,7 +662,8 @@ class _$PersonQuery extends QueryReference isGreaterThanOrEqualTo: isGreaterThanOrEqualTo, whereIn: whereIn, whereNotIn: whereNotIn, - isNull: isNull ?? + isNull: + isNull ?? (isEqualTo == null ? false : null) ?? (isNotEqualTo == null ? true : null), ), @@ -692,7 +707,8 @@ class _$PersonQuery extends QueryReference : null, whereIn: whereIn?.map((e) => _$PersonPerFieldToJson.firstName(e)), whereNotIn: whereNotIn?.map((e) => _$PersonPerFieldToJson.firstName(e)), - isNull: isNull ?? + isNull: + isNull ?? (isEqualTo == null ? false : null) ?? (isNotEqualTo == null ? true : null), ), @@ -736,7 +752,8 @@ class _$PersonQuery extends QueryReference : null, whereIn: whereIn?.map((e) => _$PersonPerFieldToJson.lastName(e)), whereNotIn: whereNotIn?.map((e) => _$PersonPerFieldToJson.lastName(e)), - isNull: isNull ?? + isNull: + isNull ?? (isEqualTo == null ? false : null) ?? (isNotEqualTo == null ? true : null), ), @@ -757,8 +774,10 @@ class _$PersonQuery extends QueryReference PersonDocumentSnapshot? endBeforeDocument, PersonDocumentSnapshot? startAfterDocument, }) { - final query = - $referenceWithoutCursor.orderBy(fieldPath, descending: descending); + final query = $referenceWithoutCursor.orderBy( + fieldPath, + descending: descending, + ); var queryCursor = $queryCursor; if (startAtDocument != null) { @@ -830,8 +849,10 @@ class _$PersonQuery extends QueryReference PersonDocumentSnapshot? endBeforeDocument, PersonDocumentSnapshot? startAfterDocument, }) { - final query = $referenceWithoutCursor.orderBy(FieldPath.documentId, - descending: descending); + final query = $referenceWithoutCursor.orderBy( + FieldPath.documentId, + descending: descending, + ); var queryCursor = $queryCursor; if (startAtDocument != null) { @@ -903,8 +924,10 @@ class _$PersonQuery extends QueryReference PersonDocumentSnapshot? endBeforeDocument, PersonDocumentSnapshot? startAfterDocument, }) { - final query = $referenceWithoutCursor - .orderBy(_$PersonFieldMap['firstName']!, descending: descending); + final query = $referenceWithoutCursor.orderBy( + _$PersonFieldMap['firstName']!, + descending: descending, + ); var queryCursor = $queryCursor; if (startAtDocument != null) { @@ -936,7 +959,7 @@ class _$PersonQuery extends QueryReference queryCursor = queryCursor.copyWith( startAt: [ ...queryCursor.startAt, - _$PersonPerFieldToJson.firstName(startAt as String) + _$PersonPerFieldToJson.firstName(startAt as String), ], startAtDocumentSnapshot: null, ); @@ -945,7 +968,7 @@ class _$PersonQuery extends QueryReference queryCursor = queryCursor.copyWith( startAfter: [ ...queryCursor.startAfter, - _$PersonPerFieldToJson.firstName(startAfter as String) + _$PersonPerFieldToJson.firstName(startAfter as String), ], startAfterDocumentSnapshot: null, ); @@ -954,7 +977,7 @@ class _$PersonQuery extends QueryReference queryCursor = queryCursor.copyWith( endAt: [ ...queryCursor.endAt, - _$PersonPerFieldToJson.firstName(endAt as String) + _$PersonPerFieldToJson.firstName(endAt as String), ], endAtDocumentSnapshot: null, ); @@ -963,7 +986,7 @@ class _$PersonQuery extends QueryReference queryCursor = queryCursor.copyWith( endBefore: [ ...queryCursor.endBefore, - _$PersonPerFieldToJson.firstName(endBefore as String) + _$PersonPerFieldToJson.firstName(endBefore as String), ], endBeforeDocumentSnapshot: null, ); @@ -988,8 +1011,10 @@ class _$PersonQuery extends QueryReference PersonDocumentSnapshot? endBeforeDocument, PersonDocumentSnapshot? startAfterDocument, }) { - final query = $referenceWithoutCursor.orderBy(_$PersonFieldMap['lastName']!, - descending: descending); + final query = $referenceWithoutCursor.orderBy( + _$PersonFieldMap['lastName']!, + descending: descending, + ); var queryCursor = $queryCursor; if (startAtDocument != null) { @@ -1021,7 +1046,7 @@ class _$PersonQuery extends QueryReference queryCursor = queryCursor.copyWith( startAt: [ ...queryCursor.startAt, - _$PersonPerFieldToJson.lastName(startAt as String) + _$PersonPerFieldToJson.lastName(startAt as String), ], startAtDocumentSnapshot: null, ); @@ -1030,7 +1055,7 @@ class _$PersonQuery extends QueryReference queryCursor = queryCursor.copyWith( startAfter: [ ...queryCursor.startAfter, - _$PersonPerFieldToJson.lastName(startAfter as String) + _$PersonPerFieldToJson.lastName(startAfter as String), ], startAfterDocumentSnapshot: null, ); @@ -1039,7 +1064,7 @@ class _$PersonQuery extends QueryReference queryCursor = queryCursor.copyWith( endAt: [ ...queryCursor.endAt, - _$PersonPerFieldToJson.lastName(endAt as String) + _$PersonPerFieldToJson.lastName(endAt as String), ], endAtDocumentSnapshot: null, ); @@ -1048,7 +1073,7 @@ class _$PersonQuery extends QueryReference queryCursor = queryCursor.copyWith( endBefore: [ ...queryCursor.endBefore, - _$PersonPerFieldToJson.lastName(endBefore as String) + _$PersonPerFieldToJson.lastName(endBefore as String), ], endBeforeDocumentSnapshot: null, ); @@ -1080,9 +1105,7 @@ class PersonDocumentSnapshot extends FirestoreDocumentSnapshot { @override PersonDocumentReference get reference { - return PersonDocumentReference( - snapshot.reference, - ); + return PersonDocumentReference(snapshot.reference); } @override @@ -1091,11 +1114,7 @@ class PersonDocumentSnapshot extends FirestoreDocumentSnapshot { class PersonQuerySnapshot extends FirestoreQuerySnapshot { - PersonQuerySnapshot._( - this.snapshot, - this.docs, - this.docChanges, - ); + PersonQuerySnapshot._(this.snapshot, this.docs, this.docChanges); factory PersonQuerySnapshot._fromQuerySnapshot( QuerySnapshot snapshot, @@ -1103,21 +1122,14 @@ class PersonQuerySnapshot final docs = snapshot.docs.map(PersonQueryDocumentSnapshot._).toList(); final docChanges = snapshot.docChanges.map((change) { - return _decodeDocumentChange( - change, - PersonDocumentSnapshot._, - ); + return _decodeDocumentChange(change, PersonDocumentSnapshot._); }).toList(); - return PersonQuerySnapshot._( - snapshot, - docs, - docChanges, - ); + return PersonQuerySnapshot._(snapshot, docs, docChanges); } static FirestoreDocumentChange - _decodeDocumentChange( + _decodeDocumentChange( DocumentChange docChange, PersonDocumentSnapshot Function(DocumentSnapshot doc) decodeDoc, ) { @@ -1160,11 +1172,12 @@ class PersonQueryDocumentSnapshot extends FirestoreQueryDocumentSnapshot abstract class PublicRedirectedCollectionReference implements PublicRedirectedQuery, - FirestoreCollectionReference { - factory PublicRedirectedCollectionReference([ - FirebaseFirestore? firestore, - ]) = _$PublicRedirectedCollectionReference; + FirestoreCollectionReference< + PublicRedirected, + PublicRedirectedQuerySnapshot + > { + factory PublicRedirectedCollectionReference([FirebaseFirestore? firestore]) = + _$PublicRedirectedCollectionReference; static PublicRedirected fromFirestore( DocumentSnapshot> snapshot, @@ -1193,12 +1206,15 @@ abstract class PublicRedirectedCollectionReference class _$PublicRedirectedCollectionReference extends _$PublicRedirectedQuery implements PublicRedirectedCollectionReference { - factory _$PublicRedirectedCollectionReference( - [FirebaseFirestore? firestore]) { + factory _$PublicRedirectedCollectionReference([ + FirebaseFirestore? firestore, + ]) { firestore ??= FirebaseFirestore.instance; return _$PublicRedirectedCollectionReference._( - firestore.collection('freezed-test').withConverter( + firestore + .collection('freezed-test') + .withConverter( fromFirestore: PublicRedirectedCollectionReference.fromFirestore, toFirestore: PublicRedirectedCollectionReference.toFirestore, ), @@ -1221,9 +1237,7 @@ class _$PublicRedirectedCollectionReference extends _$PublicRedirectedQuery id == null || id.split('/').length == 1, 'The document ID cannot be from a different collection', ); - return PublicRedirectedDocumentReference( - reference.doc(id), - ); + return PublicRedirectedDocumentReference(reference.doc(id)); } @override @@ -1245,11 +1259,14 @@ class _$PublicRedirectedCollectionReference extends _$PublicRedirectedQuery } abstract class PublicRedirectedDocumentReference - extends FirestoreDocumentReference { + extends + FirestoreDocumentReference< + PublicRedirected, + PublicRedirectedDocumentSnapshot + > { factory PublicRedirectedDocumentReference( - DocumentReference reference) = - _$PublicRedirectedDocumentReference; + DocumentReference reference, + ) = _$PublicRedirectedDocumentReference; DocumentReference get reference; @@ -1313,10 +1330,7 @@ abstract class PublicRedirectedDocumentReference /// document data. /// /// If no document exists yet, the update will fail. - Future update({ - String value, - FieldValue valueFieldValue, - }); + Future update({String value, FieldValue valueFieldValue}); /// Updates fields in the current document using the transaction API. /// @@ -1337,8 +1351,12 @@ abstract class PublicRedirectedDocumentReference }); } -class _$PublicRedirectedDocumentReference extends FirestoreDocumentReference< - PublicRedirected, PublicRedirectedDocumentSnapshot> +class _$PublicRedirectedDocumentReference + extends + FirestoreDocumentReference< + PublicRedirected, + PublicRedirectedDocumentSnapshot + > implements PublicRedirectedDocumentReference { _$PublicRedirectedDocumentReference(this.reference); @@ -1362,7 +1380,8 @@ class _$PublicRedirectedDocumentReference extends FirestoreDocumentReference< @override Future transactionGet( - Transaction transaction) { + Transaction transaction, + ) { return transaction.get(reference).then(PublicRedirectedDocumentSnapshot._); } @@ -1432,8 +1451,9 @@ class _$PublicRedirectedDocumentReference extends FirestoreDocumentReference< ); final json = { if (value != _sentinel) - _$PublicRedirected2FieldMap['value']!: - _$PublicRedirected2PerFieldToJson.value(value as String), + _$PublicRedirected2FieldMap['value']!: _$PublicRedirected2PerFieldToJson + .value(value as String), + if (valueFieldValue != null) _$PublicRedirected2FieldMap['value']!: valueFieldValue, }; @@ -1452,8 +1472,9 @@ class _$PublicRedirectedDocumentReference extends FirestoreDocumentReference< ); final json = { if (value != _sentinel) - _$PublicRedirected2FieldMap['value']!: - _$PublicRedirected2PerFieldToJson.value(value as String), + _$PublicRedirected2FieldMap['value']!: _$PublicRedirected2PerFieldToJson + .value(value as String), + if (valueFieldValue != null) _$PublicRedirected2FieldMap['value']!: valueFieldValue, }; @@ -1472,8 +1493,9 @@ class _$PublicRedirectedDocumentReference extends FirestoreDocumentReference< ); final json = { if (value != _sentinel) - _$PublicRedirected2FieldMap['value']!: - _$PublicRedirected2PerFieldToJson.value(value as String), + _$PublicRedirected2FieldMap['value']!: _$PublicRedirected2PerFieldToJson + .value(value as String), + if (valueFieldValue != null) _$PublicRedirected2FieldMap['value']!: valueFieldValue, }; @@ -1623,17 +1645,17 @@ class _$PublicRedirectedQuery required Query $referenceWithoutCursor, $QueryCursor $queryCursor = const $QueryCursor(), }) : super( - $referenceWithoutCursor: $referenceWithoutCursor, - $queryCursor: $queryCursor, - ); + $referenceWithoutCursor: $referenceWithoutCursor, + $queryCursor: $queryCursor, + ); final CollectionReference _collection; @override Stream snapshots([SnapshotOptions? options]) { - return reference - .snapshots() - .map(PublicRedirectedQuerySnapshot._fromQuerySnapshot); + return reference.snapshots().map( + PublicRedirectedQuerySnapshot._fromQuerySnapshot, + ); } @override @@ -1690,7 +1712,8 @@ class _$PublicRedirectedQuery arrayContainsAny: arrayContainsAny, whereIn: whereIn, whereNotIn: whereNotIn, - isNull: isNull ?? + isNull: + isNull ?? (isEqualTo == null ? false : null) ?? (isNotEqualTo == null ? true : null), ), @@ -1722,7 +1745,8 @@ class _$PublicRedirectedQuery isGreaterThanOrEqualTo: isGreaterThanOrEqualTo, whereIn: whereIn, whereNotIn: whereNotIn, - isNull: isNull ?? + isNull: + isNull ?? (isEqualTo == null ? false : null) ?? (isNotEqualTo == null ? true : null), ), @@ -1756,21 +1780,26 @@ class _$PublicRedirectedQuery ? _$PublicRedirected2PerFieldToJson.value(isLessThan as String) : null, isLessThanOrEqualTo: isLessThanOrEqualTo != null - ? _$PublicRedirected2PerFieldToJson - .value(isLessThanOrEqualTo as String) + ? _$PublicRedirected2PerFieldToJson.value( + isLessThanOrEqualTo as String, + ) : null, isGreaterThan: isGreaterThan != null ? _$PublicRedirected2PerFieldToJson.value(isGreaterThan as String) : null, isGreaterThanOrEqualTo: isGreaterThanOrEqualTo != null - ? _$PublicRedirected2PerFieldToJson - .value(isGreaterThanOrEqualTo as String) + ? _$PublicRedirected2PerFieldToJson.value( + isGreaterThanOrEqualTo as String, + ) : null, - whereIn: - whereIn?.map((e) => _$PublicRedirected2PerFieldToJson.value(e)), - whereNotIn: - whereNotIn?.map((e) => _$PublicRedirected2PerFieldToJson.value(e)), - isNull: isNull ?? + whereIn: whereIn?.map( + (e) => _$PublicRedirected2PerFieldToJson.value(e), + ), + whereNotIn: whereNotIn?.map( + (e) => _$PublicRedirected2PerFieldToJson.value(e), + ), + isNull: + isNull ?? (isEqualTo == null ? false : null) ?? (isNotEqualTo == null ? true : null), ), @@ -1791,8 +1820,10 @@ class _$PublicRedirectedQuery PublicRedirectedDocumentSnapshot? endBeforeDocument, PublicRedirectedDocumentSnapshot? startAfterDocument, }) { - final query = - $referenceWithoutCursor.orderBy(fieldPath, descending: descending); + final query = $referenceWithoutCursor.orderBy( + fieldPath, + descending: descending, + ); var queryCursor = $queryCursor; if (startAtDocument != null) { @@ -1864,8 +1895,10 @@ class _$PublicRedirectedQuery PublicRedirectedDocumentSnapshot? endBeforeDocument, PublicRedirectedDocumentSnapshot? startAfterDocument, }) { - final query = $referenceWithoutCursor.orderBy(FieldPath.documentId, - descending: descending); + final query = $referenceWithoutCursor.orderBy( + FieldPath.documentId, + descending: descending, + ); var queryCursor = $queryCursor; if (startAtDocument != null) { @@ -1937,8 +1970,10 @@ class _$PublicRedirectedQuery PublicRedirectedDocumentSnapshot? endBeforeDocument, PublicRedirectedDocumentSnapshot? startAfterDocument, }) { - final query = $referenceWithoutCursor - .orderBy(_$PublicRedirected2FieldMap['value']!, descending: descending); + final query = $referenceWithoutCursor.orderBy( + _$PublicRedirected2FieldMap['value']!, + descending: descending, + ); var queryCursor = $queryCursor; if (startAtDocument != null) { @@ -1970,7 +2005,7 @@ class _$PublicRedirectedQuery queryCursor = queryCursor.copyWith( startAt: [ ...queryCursor.startAt, - _$PublicRedirected2PerFieldToJson.value(startAt as String) + _$PublicRedirected2PerFieldToJson.value(startAt as String), ], startAtDocumentSnapshot: null, ); @@ -1979,7 +2014,7 @@ class _$PublicRedirectedQuery queryCursor = queryCursor.copyWith( startAfter: [ ...queryCursor.startAfter, - _$PublicRedirected2PerFieldToJson.value(startAfter as String) + _$PublicRedirected2PerFieldToJson.value(startAfter as String), ], startAfterDocumentSnapshot: null, ); @@ -1988,7 +2023,7 @@ class _$PublicRedirectedQuery queryCursor = queryCursor.copyWith( endAt: [ ...queryCursor.endAt, - _$PublicRedirected2PerFieldToJson.value(endAt as String) + _$PublicRedirected2PerFieldToJson.value(endAt as String), ], endAtDocumentSnapshot: null, ); @@ -1997,7 +2032,7 @@ class _$PublicRedirectedQuery queryCursor = queryCursor.copyWith( endBefore: [ ...queryCursor.endBefore, - _$PublicRedirected2PerFieldToJson.value(endBefore as String) + _$PublicRedirected2PerFieldToJson.value(endBefore as String), ], endBeforeDocumentSnapshot: null, ); @@ -2030,48 +2065,40 @@ class PublicRedirectedDocumentSnapshot @override PublicRedirectedDocumentReference get reference { - return PublicRedirectedDocumentReference( - snapshot.reference, - ); + return PublicRedirectedDocumentReference(snapshot.reference); } @override final PublicRedirected? data; } -class PublicRedirectedQuerySnapshot extends FirestoreQuerySnapshot< - PublicRedirected, PublicRedirectedQueryDocumentSnapshot> { - PublicRedirectedQuerySnapshot._( - this.snapshot, - this.docs, - this.docChanges, - ); +class PublicRedirectedQuerySnapshot + extends + FirestoreQuerySnapshot< + PublicRedirected, + PublicRedirectedQueryDocumentSnapshot + > { + PublicRedirectedQuerySnapshot._(this.snapshot, this.docs, this.docChanges); factory PublicRedirectedQuerySnapshot._fromQuerySnapshot( QuerySnapshot snapshot, ) { - final docs = - snapshot.docs.map(PublicRedirectedQueryDocumentSnapshot._).toList(); + final docs = snapshot.docs + .map(PublicRedirectedQueryDocumentSnapshot._) + .toList(); final docChanges = snapshot.docChanges.map((change) { - return _decodeDocumentChange( - change, - PublicRedirectedDocumentSnapshot._, - ); + return _decodeDocumentChange(change, PublicRedirectedDocumentSnapshot._); }).toList(); - return PublicRedirectedQuerySnapshot._( - snapshot, - docs, - docChanges, - ); + return PublicRedirectedQuerySnapshot._(snapshot, docs, docChanges); } static FirestoreDocumentChange - _decodeDocumentChange( + _decodeDocumentChange( DocumentChange docChange, PublicRedirectedDocumentSnapshot Function(DocumentSnapshot doc) - decodeDoc, + decodeDoc, ) { return FirestoreDocumentChange( type: docChange.type, @@ -2088,14 +2115,14 @@ class PublicRedirectedQuerySnapshot extends FirestoreQuerySnapshot< @override final List> - docChanges; + docChanges; } class PublicRedirectedQueryDocumentSnapshot extends FirestoreQueryDocumentSnapshot implements PublicRedirectedDocumentSnapshot { PublicRedirectedQueryDocumentSnapshot._(this.snapshot) - : data = snapshot.data(); + : data = snapshot.data(); @override final QueryDocumentSnapshot snapshot; @@ -2115,11 +2142,12 @@ class PublicRedirectedQueryDocumentSnapshot abstract class SimpleFreezedCollectionReference implements SimpleFreezedQuery, - FirestoreCollectionReference { - factory SimpleFreezedCollectionReference([ - FirebaseFirestore? firestore, - ]) = _$SimpleFreezedCollectionReference; + FirestoreCollectionReference< + SimpleFreezed, + SimpleFreezedQuerySnapshot + > { + factory SimpleFreezedCollectionReference([FirebaseFirestore? firestore]) = + _$SimpleFreezedCollectionReference; static SimpleFreezed fromFirestore( DocumentSnapshot> snapshot, @@ -2152,7 +2180,9 @@ class _$SimpleFreezedCollectionReference extends _$SimpleFreezedQuery firestore ??= FirebaseFirestore.instance; return _$SimpleFreezedCollectionReference._( - firestore.collection('freezed-test').withConverter( + firestore + .collection('freezed-test') + .withConverter( fromFirestore: SimpleFreezedCollectionReference.fromFirestore, toFirestore: SimpleFreezedCollectionReference.toFirestore, ), @@ -2175,9 +2205,7 @@ class _$SimpleFreezedCollectionReference extends _$SimpleFreezedQuery id == null || id.split('/').length == 1, 'The document ID cannot be from a different collection', ); - return SimpleFreezedDocumentReference( - reference.doc(id), - ); + return SimpleFreezedDocumentReference(reference.doc(id)); } @override @@ -2199,11 +2227,14 @@ class _$SimpleFreezedCollectionReference extends _$SimpleFreezedQuery } abstract class SimpleFreezedDocumentReference - extends FirestoreDocumentReference { + extends + FirestoreDocumentReference< + SimpleFreezed, + SimpleFreezedDocumentSnapshot + > { factory SimpleFreezedDocumentReference( - DocumentReference reference) = - _$SimpleFreezedDocumentReference; + DocumentReference reference, + ) = _$SimpleFreezedDocumentReference; DocumentReference get reference; @@ -2267,10 +2298,7 @@ abstract class SimpleFreezedDocumentReference /// document data. /// /// If no document exists yet, the update will fail. - Future update({ - int a, - FieldValue aFieldValue, - }); + Future update({int a, FieldValue aFieldValue}); /// Updates fields in the current document using the transaction API. /// @@ -2284,16 +2312,13 @@ abstract class SimpleFreezedDocumentReference /// Updates fields in the current document using the batch API. /// /// The update will fail if applied to a document that does not exist. - void batchUpdate( - WriteBatch batch, { - int a, - FieldValue aFieldValue, - }); + void batchUpdate(WriteBatch batch, {int a, FieldValue aFieldValue}); } -class _$SimpleFreezedDocumentReference extends FirestoreDocumentReference< - SimpleFreezed, - SimpleFreezedDocumentSnapshot> implements SimpleFreezedDocumentReference { +class _$SimpleFreezedDocumentReference + extends + FirestoreDocumentReference + implements SimpleFreezedDocumentReference { _$SimpleFreezedDocumentReference(this.reference); @override @@ -2316,7 +2341,8 @@ class _$SimpleFreezedDocumentReference extends FirestoreDocumentReference< @override Future transactionGet( - Transaction transaction) { + Transaction transaction, + ) { return transaction.get(reference).then(SimpleFreezedDocumentSnapshot._); } @@ -2373,18 +2399,17 @@ class _$SimpleFreezedDocumentReference extends FirestoreDocumentReference< batch.set(castedReference, json, options); } - Future update({ - Object? a = _sentinel, - FieldValue? aFieldValue, - }) async { + Future update({Object? a = _sentinel, FieldValue? aFieldValue}) async { assert( a == _sentinel || aFieldValue == null, "Cannot specify both a and aFieldValue", ); final json = { if (a != _sentinel) - _$SimpleFreezedFieldMap['a']!: - _$SimpleFreezedPerFieldToJson.a(a as int), + _$SimpleFreezedFieldMap['a']!: _$SimpleFreezedPerFieldToJson.a( + a as int, + ), + if (aFieldValue != null) _$SimpleFreezedFieldMap['a']!: aFieldValue, }; @@ -2402,8 +2427,10 @@ class _$SimpleFreezedDocumentReference extends FirestoreDocumentReference< ); final json = { if (a != _sentinel) - _$SimpleFreezedFieldMap['a']!: - _$SimpleFreezedPerFieldToJson.a(a as int), + _$SimpleFreezedFieldMap['a']!: _$SimpleFreezedPerFieldToJson.a( + a as int, + ), + if (aFieldValue != null) _$SimpleFreezedFieldMap['a']!: aFieldValue, }; @@ -2421,8 +2448,10 @@ class _$SimpleFreezedDocumentReference extends FirestoreDocumentReference< ); final json = { if (a != _sentinel) - _$SimpleFreezedFieldMap['a']!: - _$SimpleFreezedPerFieldToJson.a(a as int), + _$SimpleFreezedFieldMap['a']!: _$SimpleFreezedPerFieldToJson.a( + a as int, + ), + if (aFieldValue != null) _$SimpleFreezedFieldMap['a']!: aFieldValue, }; @@ -2571,17 +2600,17 @@ class _$SimpleFreezedQuery required Query $referenceWithoutCursor, $QueryCursor $queryCursor = const $QueryCursor(), }) : super( - $referenceWithoutCursor: $referenceWithoutCursor, - $queryCursor: $queryCursor, - ); + $referenceWithoutCursor: $referenceWithoutCursor, + $queryCursor: $queryCursor, + ); final CollectionReference _collection; @override Stream snapshots([SnapshotOptions? options]) { - return reference - .snapshots() - .map(SimpleFreezedQuerySnapshot._fromQuerySnapshot); + return reference.snapshots().map( + SimpleFreezedQuerySnapshot._fromQuerySnapshot, + ); } @override @@ -2638,7 +2667,8 @@ class _$SimpleFreezedQuery arrayContainsAny: arrayContainsAny, whereIn: whereIn, whereNotIn: whereNotIn, - isNull: isNull ?? + isNull: + isNull ?? (isEqualTo == null ? false : null) ?? (isNotEqualTo == null ? true : null), ), @@ -2670,7 +2700,8 @@ class _$SimpleFreezedQuery isGreaterThanOrEqualTo: isGreaterThanOrEqualTo, whereIn: whereIn, whereNotIn: whereNotIn, - isNull: isNull ?? + isNull: + isNull ?? (isEqualTo == null ? false : null) ?? (isNotEqualTo == null ? true : null), ), @@ -2714,7 +2745,8 @@ class _$SimpleFreezedQuery : null, whereIn: whereIn?.map((e) => _$SimpleFreezedPerFieldToJson.a(e)), whereNotIn: whereNotIn?.map((e) => _$SimpleFreezedPerFieldToJson.a(e)), - isNull: isNull ?? + isNull: + isNull ?? (isEqualTo == null ? false : null) ?? (isNotEqualTo == null ? true : null), ), @@ -2735,8 +2767,10 @@ class _$SimpleFreezedQuery SimpleFreezedDocumentSnapshot? endBeforeDocument, SimpleFreezedDocumentSnapshot? startAfterDocument, }) { - final query = - $referenceWithoutCursor.orderBy(fieldPath, descending: descending); + final query = $referenceWithoutCursor.orderBy( + fieldPath, + descending: descending, + ); var queryCursor = $queryCursor; if (startAtDocument != null) { @@ -2808,8 +2842,10 @@ class _$SimpleFreezedQuery SimpleFreezedDocumentSnapshot? endBeforeDocument, SimpleFreezedDocumentSnapshot? startAfterDocument, }) { - final query = $referenceWithoutCursor.orderBy(FieldPath.documentId, - descending: descending); + final query = $referenceWithoutCursor.orderBy( + FieldPath.documentId, + descending: descending, + ); var queryCursor = $queryCursor; if (startAtDocument != null) { @@ -2881,8 +2917,10 @@ class _$SimpleFreezedQuery SimpleFreezedDocumentSnapshot? endBeforeDocument, SimpleFreezedDocumentSnapshot? startAfterDocument, }) { - final query = $referenceWithoutCursor.orderBy(_$SimpleFreezedFieldMap['a']!, - descending: descending); + final query = $referenceWithoutCursor.orderBy( + _$SimpleFreezedFieldMap['a']!, + descending: descending, + ); var queryCursor = $queryCursor; if (startAtDocument != null) { @@ -2914,7 +2952,7 @@ class _$SimpleFreezedQuery queryCursor = queryCursor.copyWith( startAt: [ ...queryCursor.startAt, - _$SimpleFreezedPerFieldToJson.a(startAt as int) + _$SimpleFreezedPerFieldToJson.a(startAt as int), ], startAtDocumentSnapshot: null, ); @@ -2923,7 +2961,7 @@ class _$SimpleFreezedQuery queryCursor = queryCursor.copyWith( startAfter: [ ...queryCursor.startAfter, - _$SimpleFreezedPerFieldToJson.a(startAfter as int) + _$SimpleFreezedPerFieldToJson.a(startAfter as int), ], startAfterDocumentSnapshot: null, ); @@ -2932,7 +2970,7 @@ class _$SimpleFreezedQuery queryCursor = queryCursor.copyWith( endAt: [ ...queryCursor.endAt, - _$SimpleFreezedPerFieldToJson.a(endAt as int) + _$SimpleFreezedPerFieldToJson.a(endAt as int), ], endAtDocumentSnapshot: null, ); @@ -2941,7 +2979,7 @@ class _$SimpleFreezedQuery queryCursor = queryCursor.copyWith( endBefore: [ ...queryCursor.endBefore, - _$SimpleFreezedPerFieldToJson.a(endBefore as int) + _$SimpleFreezedPerFieldToJson.a(endBefore as int), ], endBeforeDocumentSnapshot: null, ); @@ -2974,45 +3012,37 @@ class SimpleFreezedDocumentSnapshot @override SimpleFreezedDocumentReference get reference { - return SimpleFreezedDocumentReference( - snapshot.reference, - ); + return SimpleFreezedDocumentReference(snapshot.reference); } @override final SimpleFreezed? data; } -class SimpleFreezedQuerySnapshot extends FirestoreQuerySnapshot { - SimpleFreezedQuerySnapshot._( - this.snapshot, - this.docs, - this.docChanges, - ); +class SimpleFreezedQuerySnapshot + extends + FirestoreQuerySnapshot< + SimpleFreezed, + SimpleFreezedQueryDocumentSnapshot + > { + SimpleFreezedQuerySnapshot._(this.snapshot, this.docs, this.docChanges); factory SimpleFreezedQuerySnapshot._fromQuerySnapshot( QuerySnapshot snapshot, ) { - final docs = - snapshot.docs.map(SimpleFreezedQueryDocumentSnapshot._).toList(); + final docs = snapshot.docs + .map(SimpleFreezedQueryDocumentSnapshot._) + .toList(); final docChanges = snapshot.docChanges.map((change) { - return _decodeDocumentChange( - change, - SimpleFreezedDocumentSnapshot._, - ); + return _decodeDocumentChange(change, SimpleFreezedDocumentSnapshot._); }).toList(); - return SimpleFreezedQuerySnapshot._( - snapshot, - docs, - docChanges, - ); + return SimpleFreezedQuerySnapshot._(snapshot, docs, docChanges); } static FirestoreDocumentChange - _decodeDocumentChange( + _decodeDocumentChange( DocumentChange docChange, SimpleFreezedDocumentSnapshot Function(DocumentSnapshot doc) decodeDoc, ) { @@ -3055,13 +3085,9 @@ class SimpleFreezedQueryDocumentSnapshot // ************************************************************************** SimpleFreezed _$SimpleFreezedFromJson(Map json) => - SimpleFreezed( - a: (json['a'] as num).toInt(), - ); + SimpleFreezed(a: (json['a'] as num).toInt()); -const _$SimpleFreezedFieldMap = { - 'a': 'a', -}; +const _$SimpleFreezedFieldMap = {'a': 'a'}; // ignore: unused_element abstract class _$SimpleFreezedPerFieldToJson { @@ -3070,14 +3096,12 @@ abstract class _$SimpleFreezedPerFieldToJson { } Map _$SimpleFreezedToJson(SimpleFreezed instance) => - { - 'a': instance.a, - }; + {'a': instance.a}; _Person _$PersonFromJson(Map json) => _Person( - firstName: json['first_name'] as String, - lastName: json['LAST_NAME'] as String, - ); + firstName: json['first_name'] as String, + lastName: json['LAST_NAME'] as String, +); const _$PersonFieldMap = { 'firstName': 'first_name', @@ -3093,18 +3117,14 @@ abstract class _$PersonPerFieldToJson { } Map _$PersonToJson(_Person instance) => { - 'first_name': instance.firstName, - 'LAST_NAME': instance.lastName, - }; + 'first_name': instance.firstName, + 'LAST_NAME': instance.lastName, +}; PublicRedirected2 _$PublicRedirected2FromJson(Map json) => - PublicRedirected2( - value: json['value'] as String, - ); + PublicRedirected2(value: json['value'] as String); -const _$PublicRedirected2FieldMap = { - 'value': 'value', -}; +const _$PublicRedirected2FieldMap = {'value': 'value'}; // ignore: unused_element abstract class _$PublicRedirected2PerFieldToJson { @@ -3113,6 +3133,4 @@ abstract class _$PublicRedirected2PerFieldToJson { } Map _$PublicRedirected2ToJson(PublicRedirected2 instance) => - { - 'value': instance.value, - }; + {'value': instance.value}; diff --git a/packages/cloud_firestore_odm_generator/cloud_firestore_odm_generator_integration_test/lib/simple.dart b/packages/cloud_firestore_odm_generator/cloud_firestore_odm_generator_integration_test/lib/simple.dart index 038ef41..3ff9923 100644 --- a/packages/cloud_firestore_odm_generator/cloud_firestore_odm_generator_integration_test/lib/simple.dart +++ b/packages/cloud_firestore_odm_generator/cloud_firestore_odm_generator_integration_test/lib/simple.dart @@ -35,11 +35,7 @@ class Model { final String value; } -enum TestEnum { - one, - two, - three; -} +enum TestEnum { one, two, three } @JsonSerializable() class Nested { @@ -85,8 +81,7 @@ final nestedRef = NestedCollectionReference(); class EmptyModel { EmptyModel(); - factory EmptyModel.fromJson(Map json) => - _$EmptyModelFromJson(json); + factory EmptyModel.fromJson(Map json) => _$EmptyModelFromJson(json); Map toJson() => _$EmptyModelToJson(this); } @@ -136,8 +131,7 @@ final optionalJsonRef = OptionalJsonCollectionReference(); class MixedJson { MixedJson(this.value); - factory MixedJson.fromJson(Map json) => - MixedJson(json['foo']! as int); + factory MixedJson.fromJson(Map json) => MixedJson(json['foo']! as int); final int value; @@ -163,8 +157,7 @@ class Sub { class CustomSubName { CustomSubName(this.value); - factory CustomSubName.fromJson(Map json) => - _$CustomSubNameFromJson(json); + factory CustomSubName.fromJson(Map json) => _$CustomSubNameFromJson(json); final num value; @@ -175,8 +168,7 @@ class CustomSubName { class AsCamelCase { AsCamelCase(this.value); - factory AsCamelCase.fromJson(Map json) => - _$AsCamelCaseFromJson(json); + factory AsCamelCase.fromJson(Map json) => _$AsCamelCaseFromJson(json); final num value; @@ -199,18 +191,14 @@ class CustomClassPrefix { @Collection('root/*/sub') @Collection('root/*/as-camel-case') @Collection('root/*/custom-sub-name', name: 'thisIsACustomName') -@Collection( - 'root/*/custom-class-prefix', - prefix: 'ThisIsACustomPrefix', -) +@Collection('root/*/custom-class-prefix', prefix: 'ThisIsACustomPrefix') final rootRef = RootCollectionReference(); @JsonSerializable() class ExplicitPath { ExplicitPath(this.value); - factory ExplicitPath.fromJson(Map json) => - _$ExplicitPathFromJson(json); + factory ExplicitPath.fromJson(Map json) => _$ExplicitPathFromJson(json); final num value; @@ -221,8 +209,7 @@ class ExplicitPath { class ExplicitSubPath { ExplicitSubPath(this.value); - factory ExplicitSubPath.fromJson(Map json) => - _$ExplicitSubPathFromJson(json); + factory ExplicitSubPath.fromJson(Map json) => _$ExplicitSubPathFromJson(json); final num value; @@ -244,8 +231,7 @@ abstract class BaseClass { class SubClass extends BaseClass { SubClass(super.instanceGetter); - factory SubClass.fromJson(Map json) => - _$SubClassFromJson(json); + factory SubClass.fromJson(Map json) => _$SubClassFromJson(json); Map toJson() => _$SubClassToJson(this); } diff --git a/packages/cloud_firestore_odm_generator/cloud_firestore_odm_generator_integration_test/lib/simple.g.dart b/packages/cloud_firestore_odm_generator/cloud_firestore_odm_generator_integration_test/lib/simple.g.dart index 031de0c..f70e1fc 100644 --- a/packages/cloud_firestore_odm_generator/cloud_firestore_odm_generator_integration_test/lib/simple.g.dart +++ b/packages/cloud_firestore_odm_generator/cloud_firestore_odm_generator_integration_test/lib/simple.g.dart @@ -23,11 +23,12 @@ const _sentinel = _Sentinel(); abstract class IgnoredGetterCollectionReference implements IgnoredGetterQuery, - FirestoreCollectionReference { - factory IgnoredGetterCollectionReference([ - FirebaseFirestore? firestore, - ]) = _$IgnoredGetterCollectionReference; + FirestoreCollectionReference< + IgnoredGetter, + IgnoredGetterQuerySnapshot + > { + factory IgnoredGetterCollectionReference([FirebaseFirestore? firestore]) = + _$IgnoredGetterCollectionReference; static IgnoredGetter fromFirestore( DocumentSnapshot> snapshot, @@ -60,7 +61,9 @@ class _$IgnoredGetterCollectionReference extends _$IgnoredGetterQuery firestore ??= FirebaseFirestore.instance; return _$IgnoredGetterCollectionReference._( - firestore.collection('firestore-example-app/test/getter').withConverter( + firestore + .collection('firestore-example-app/test/getter') + .withConverter( fromFirestore: IgnoredGetterCollectionReference.fromFirestore, toFirestore: IgnoredGetterCollectionReference.toFirestore, ), @@ -83,9 +86,7 @@ class _$IgnoredGetterCollectionReference extends _$IgnoredGetterQuery id == null || id.split('/').length == 1, 'The document ID cannot be from a different collection', ); - return IgnoredGetterDocumentReference( - reference.doc(id), - ); + return IgnoredGetterDocumentReference(reference.doc(id)); } @override @@ -107,11 +108,14 @@ class _$IgnoredGetterCollectionReference extends _$IgnoredGetterQuery } abstract class IgnoredGetterDocumentReference - extends FirestoreDocumentReference { + extends + FirestoreDocumentReference< + IgnoredGetter, + IgnoredGetterDocumentSnapshot + > { factory IgnoredGetterDocumentReference( - DocumentReference reference) = - _$IgnoredGetterDocumentReference; + DocumentReference reference, + ) = _$IgnoredGetterDocumentReference; DocumentReference get reference; @@ -175,10 +179,7 @@ abstract class IgnoredGetterDocumentReference /// document data. /// /// If no document exists yet, the update will fail. - Future update({ - int value, - FieldValue valueFieldValue, - }); + Future update({int value, FieldValue valueFieldValue}); /// Updates fields in the current document using the transaction API. /// @@ -192,16 +193,13 @@ abstract class IgnoredGetterDocumentReference /// Updates fields in the current document using the batch API. /// /// The update will fail if applied to a document that does not exist. - void batchUpdate( - WriteBatch batch, { - int value, - FieldValue valueFieldValue, - }); + void batchUpdate(WriteBatch batch, {int value, FieldValue valueFieldValue}); } -class _$IgnoredGetterDocumentReference extends FirestoreDocumentReference< - IgnoredGetter, - IgnoredGetterDocumentSnapshot> implements IgnoredGetterDocumentReference { +class _$IgnoredGetterDocumentReference + extends + FirestoreDocumentReference + implements IgnoredGetterDocumentReference { _$IgnoredGetterDocumentReference(this.reference); @override @@ -224,7 +222,8 @@ class _$IgnoredGetterDocumentReference extends FirestoreDocumentReference< @override Future transactionGet( - Transaction transaction) { + Transaction transaction, + ) { return transaction.get(reference).then(IgnoredGetterDocumentSnapshot._); } @@ -294,8 +293,10 @@ class _$IgnoredGetterDocumentReference extends FirestoreDocumentReference< ); final json = { if (value != _sentinel) - _$IgnoredGetterFieldMap['value']!: - _$IgnoredGetterPerFieldToJson.value(value as int), + _$IgnoredGetterFieldMap['value']!: _$IgnoredGetterPerFieldToJson.value( + value as int, + ), + if (valueFieldValue != null) _$IgnoredGetterFieldMap['value']!: valueFieldValue, }; @@ -314,8 +315,10 @@ class _$IgnoredGetterDocumentReference extends FirestoreDocumentReference< ); final json = { if (value != _sentinel) - _$IgnoredGetterFieldMap['value']!: - _$IgnoredGetterPerFieldToJson.value(value as int), + _$IgnoredGetterFieldMap['value']!: _$IgnoredGetterPerFieldToJson.value( + value as int, + ), + if (valueFieldValue != null) _$IgnoredGetterFieldMap['value']!: valueFieldValue, }; @@ -334,8 +337,10 @@ class _$IgnoredGetterDocumentReference extends FirestoreDocumentReference< ); final json = { if (value != _sentinel) - _$IgnoredGetterFieldMap['value']!: - _$IgnoredGetterPerFieldToJson.value(value as int), + _$IgnoredGetterFieldMap['value']!: _$IgnoredGetterPerFieldToJson.value( + value as int, + ), + if (valueFieldValue != null) _$IgnoredGetterFieldMap['value']!: valueFieldValue, }; @@ -485,17 +490,17 @@ class _$IgnoredGetterQuery required Query $referenceWithoutCursor, $QueryCursor $queryCursor = const $QueryCursor(), }) : super( - $referenceWithoutCursor: $referenceWithoutCursor, - $queryCursor: $queryCursor, - ); + $referenceWithoutCursor: $referenceWithoutCursor, + $queryCursor: $queryCursor, + ); final CollectionReference _collection; @override Stream snapshots([SnapshotOptions? options]) { - return reference - .snapshots() - .map(IgnoredGetterQuerySnapshot._fromQuerySnapshot); + return reference.snapshots().map( + IgnoredGetterQuerySnapshot._fromQuerySnapshot, + ); } @override @@ -552,7 +557,8 @@ class _$IgnoredGetterQuery arrayContainsAny: arrayContainsAny, whereIn: whereIn, whereNotIn: whereNotIn, - isNull: isNull ?? + isNull: + isNull ?? (isEqualTo == null ? false : null) ?? (isNotEqualTo == null ? true : null), ), @@ -584,7 +590,8 @@ class _$IgnoredGetterQuery isGreaterThanOrEqualTo: isGreaterThanOrEqualTo, whereIn: whereIn, whereNotIn: whereNotIn, - isNull: isNull ?? + isNull: + isNull ?? (isEqualTo == null ? false : null) ?? (isNotEqualTo == null ? true : null), ), @@ -627,9 +634,11 @@ class _$IgnoredGetterQuery ? _$IgnoredGetterPerFieldToJson.value(isGreaterThanOrEqualTo as int) : null, whereIn: whereIn?.map((e) => _$IgnoredGetterPerFieldToJson.value(e)), - whereNotIn: - whereNotIn?.map((e) => _$IgnoredGetterPerFieldToJson.value(e)), - isNull: isNull ?? + whereNotIn: whereNotIn?.map( + (e) => _$IgnoredGetterPerFieldToJson.value(e), + ), + isNull: + isNull ?? (isEqualTo == null ? false : null) ?? (isNotEqualTo == null ? true : null), ), @@ -650,8 +659,10 @@ class _$IgnoredGetterQuery IgnoredGetterDocumentSnapshot? endBeforeDocument, IgnoredGetterDocumentSnapshot? startAfterDocument, }) { - final query = - $referenceWithoutCursor.orderBy(fieldPath, descending: descending); + final query = $referenceWithoutCursor.orderBy( + fieldPath, + descending: descending, + ); var queryCursor = $queryCursor; if (startAtDocument != null) { @@ -723,8 +734,10 @@ class _$IgnoredGetterQuery IgnoredGetterDocumentSnapshot? endBeforeDocument, IgnoredGetterDocumentSnapshot? startAfterDocument, }) { - final query = $referenceWithoutCursor.orderBy(FieldPath.documentId, - descending: descending); + final query = $referenceWithoutCursor.orderBy( + FieldPath.documentId, + descending: descending, + ); var queryCursor = $queryCursor; if (startAtDocument != null) { @@ -796,8 +809,10 @@ class _$IgnoredGetterQuery IgnoredGetterDocumentSnapshot? endBeforeDocument, IgnoredGetterDocumentSnapshot? startAfterDocument, }) { - final query = $referenceWithoutCursor - .orderBy(_$IgnoredGetterFieldMap['value']!, descending: descending); + final query = $referenceWithoutCursor.orderBy( + _$IgnoredGetterFieldMap['value']!, + descending: descending, + ); var queryCursor = $queryCursor; if (startAtDocument != null) { @@ -829,7 +844,7 @@ class _$IgnoredGetterQuery queryCursor = queryCursor.copyWith( startAt: [ ...queryCursor.startAt, - _$IgnoredGetterPerFieldToJson.value(startAt as int) + _$IgnoredGetterPerFieldToJson.value(startAt as int), ], startAtDocumentSnapshot: null, ); @@ -838,7 +853,7 @@ class _$IgnoredGetterQuery queryCursor = queryCursor.copyWith( startAfter: [ ...queryCursor.startAfter, - _$IgnoredGetterPerFieldToJson.value(startAfter as int) + _$IgnoredGetterPerFieldToJson.value(startAfter as int), ], startAfterDocumentSnapshot: null, ); @@ -847,7 +862,7 @@ class _$IgnoredGetterQuery queryCursor = queryCursor.copyWith( endAt: [ ...queryCursor.endAt, - _$IgnoredGetterPerFieldToJson.value(endAt as int) + _$IgnoredGetterPerFieldToJson.value(endAt as int), ], endAtDocumentSnapshot: null, ); @@ -856,7 +871,7 @@ class _$IgnoredGetterQuery queryCursor = queryCursor.copyWith( endBefore: [ ...queryCursor.endBefore, - _$IgnoredGetterPerFieldToJson.value(endBefore as int) + _$IgnoredGetterPerFieldToJson.value(endBefore as int), ], endBeforeDocumentSnapshot: null, ); @@ -889,45 +904,37 @@ class IgnoredGetterDocumentSnapshot @override IgnoredGetterDocumentReference get reference { - return IgnoredGetterDocumentReference( - snapshot.reference, - ); + return IgnoredGetterDocumentReference(snapshot.reference); } @override final IgnoredGetter? data; } -class IgnoredGetterQuerySnapshot extends FirestoreQuerySnapshot { - IgnoredGetterQuerySnapshot._( - this.snapshot, - this.docs, - this.docChanges, - ); +class IgnoredGetterQuerySnapshot + extends + FirestoreQuerySnapshot< + IgnoredGetter, + IgnoredGetterQueryDocumentSnapshot + > { + IgnoredGetterQuerySnapshot._(this.snapshot, this.docs, this.docChanges); factory IgnoredGetterQuerySnapshot._fromQuerySnapshot( QuerySnapshot snapshot, ) { - final docs = - snapshot.docs.map(IgnoredGetterQueryDocumentSnapshot._).toList(); + final docs = snapshot.docs + .map(IgnoredGetterQueryDocumentSnapshot._) + .toList(); final docChanges = snapshot.docChanges.map((change) { - return _decodeDocumentChange( - change, - IgnoredGetterDocumentSnapshot._, - ); + return _decodeDocumentChange(change, IgnoredGetterDocumentSnapshot._); }).toList(); - return IgnoredGetterQuerySnapshot._( - snapshot, - docs, - docChanges, - ); + return IgnoredGetterQuerySnapshot._(snapshot, docs, docChanges); } static FirestoreDocumentChange - _decodeDocumentChange( + _decodeDocumentChange( DocumentChange docChange, IgnoredGetterDocumentSnapshot Function(DocumentSnapshot doc) decodeDoc, ) { @@ -972,9 +979,8 @@ abstract class ModelCollectionReference implements ModelQuery, FirestoreCollectionReference { - factory ModelCollectionReference([ - FirebaseFirestore? firestore, - ]) = _$ModelCollectionReference; + factory ModelCollectionReference([FirebaseFirestore? firestore]) = + _$ModelCollectionReference; static Model fromFirestore( DocumentSnapshot> snapshot, @@ -983,10 +989,7 @@ abstract class ModelCollectionReference return _$ModelFromJson(snapshot.data()!); } - static Map toFirestore( - Model value, - SetOptions? options, - ) { + static Map toFirestore(Model value, SetOptions? options) { return _$ModelToJson(value); } @@ -1007,16 +1010,17 @@ class _$ModelCollectionReference extends _$ModelQuery firestore ??= FirebaseFirestore.instance; return _$ModelCollectionReference._( - firestore.collection('root').withConverter( + firestore + .collection('root') + .withConverter( fromFirestore: ModelCollectionReference.fromFirestore, toFirestore: ModelCollectionReference.toFirestore, ), ); } - _$ModelCollectionReference._( - CollectionReference reference, - ) : super(reference, $referenceWithoutCursor: reference); + _$ModelCollectionReference._(CollectionReference reference) + : super(reference, $referenceWithoutCursor: reference); String get path => reference.path; @@ -1030,9 +1034,7 @@ class _$ModelCollectionReference extends _$ModelQuery id == null || id.split('/').length == 1, 'The document ID cannot be from a different collection', ); - return ModelDocumentReference( - reference.doc(id), - ); + return ModelDocumentReference(reference.doc(id)); } @override @@ -1118,10 +1120,7 @@ abstract class ModelDocumentReference /// document data. /// /// If no document exists yet, the update will fail. - Future update({ - String value, - FieldValue valueFieldValue, - }); + Future update({String value, FieldValue valueFieldValue}); /// Updates fields in the current document using the transaction API. /// @@ -1234,6 +1233,7 @@ class _$ModelDocumentReference final json = { if (value != _sentinel) _$ModelFieldMap['value']!: _$ModelPerFieldToJson.value(value as String), + if (valueFieldValue != null) _$ModelFieldMap['value']!: valueFieldValue, }; @@ -1252,6 +1252,7 @@ class _$ModelDocumentReference final json = { if (value != _sentinel) _$ModelFieldMap['value']!: _$ModelPerFieldToJson.value(value as String), + if (valueFieldValue != null) _$ModelFieldMap['value']!: valueFieldValue, }; @@ -1270,6 +1271,7 @@ class _$ModelDocumentReference final json = { if (value != _sentinel) _$ModelFieldMap['value']!: _$ModelPerFieldToJson.value(value as String), + if (valueFieldValue != null) _$ModelFieldMap['value']!: valueFieldValue, }; @@ -1416,9 +1418,9 @@ class _$ModelQuery extends QueryReference required Query $referenceWithoutCursor, $QueryCursor $queryCursor = const $QueryCursor(), }) : super( - $referenceWithoutCursor: $referenceWithoutCursor, - $queryCursor: $queryCursor, - ); + $referenceWithoutCursor: $referenceWithoutCursor, + $queryCursor: $queryCursor, + ); final CollectionReference _collection; @@ -1479,7 +1481,8 @@ class _$ModelQuery extends QueryReference arrayContainsAny: arrayContainsAny, whereIn: whereIn, whereNotIn: whereNotIn, - isNull: isNull ?? + isNull: + isNull ?? (isEqualTo == null ? false : null) ?? (isNotEqualTo == null ? true : null), ), @@ -1511,7 +1514,8 @@ class _$ModelQuery extends QueryReference isGreaterThanOrEqualTo: isGreaterThanOrEqualTo, whereIn: whereIn, whereNotIn: whereNotIn, - isNull: isNull ?? + isNull: + isNull ?? (isEqualTo == null ? false : null) ?? (isNotEqualTo == null ? true : null), ), @@ -1555,7 +1559,8 @@ class _$ModelQuery extends QueryReference : null, whereIn: whereIn?.map((e) => _$ModelPerFieldToJson.value(e)), whereNotIn: whereNotIn?.map((e) => _$ModelPerFieldToJson.value(e)), - isNull: isNull ?? + isNull: + isNull ?? (isEqualTo == null ? false : null) ?? (isNotEqualTo == null ? true : null), ), @@ -1576,8 +1581,10 @@ class _$ModelQuery extends QueryReference ModelDocumentSnapshot? endBeforeDocument, ModelDocumentSnapshot? startAfterDocument, }) { - final query = - $referenceWithoutCursor.orderBy(fieldPath, descending: descending); + final query = $referenceWithoutCursor.orderBy( + fieldPath, + descending: descending, + ); var queryCursor = $queryCursor; if (startAtDocument != null) { @@ -1649,8 +1656,10 @@ class _$ModelQuery extends QueryReference ModelDocumentSnapshot? endBeforeDocument, ModelDocumentSnapshot? startAfterDocument, }) { - final query = $referenceWithoutCursor.orderBy(FieldPath.documentId, - descending: descending); + final query = $referenceWithoutCursor.orderBy( + FieldPath.documentId, + descending: descending, + ); var queryCursor = $queryCursor; if (startAtDocument != null) { @@ -1722,8 +1731,10 @@ class _$ModelQuery extends QueryReference ModelDocumentSnapshot? endBeforeDocument, ModelDocumentSnapshot? startAfterDocument, }) { - final query = $referenceWithoutCursor.orderBy(_$ModelFieldMap['value']!, - descending: descending); + final query = $referenceWithoutCursor.orderBy( + _$ModelFieldMap['value']!, + descending: descending, + ); var queryCursor = $queryCursor; if (startAtDocument != null) { @@ -1755,7 +1766,7 @@ class _$ModelQuery extends QueryReference queryCursor = queryCursor.copyWith( startAt: [ ...queryCursor.startAt, - _$ModelPerFieldToJson.value(startAt as String) + _$ModelPerFieldToJson.value(startAt as String), ], startAtDocumentSnapshot: null, ); @@ -1764,7 +1775,7 @@ class _$ModelQuery extends QueryReference queryCursor = queryCursor.copyWith( startAfter: [ ...queryCursor.startAfter, - _$ModelPerFieldToJson.value(startAfter as String) + _$ModelPerFieldToJson.value(startAfter as String), ], startAfterDocumentSnapshot: null, ); @@ -1773,7 +1784,7 @@ class _$ModelQuery extends QueryReference queryCursor = queryCursor.copyWith( endAt: [ ...queryCursor.endAt, - _$ModelPerFieldToJson.value(endAt as String) + _$ModelPerFieldToJson.value(endAt as String), ], endAtDocumentSnapshot: null, ); @@ -1782,7 +1793,7 @@ class _$ModelQuery extends QueryReference queryCursor = queryCursor.copyWith( endBefore: [ ...queryCursor.endBefore, - _$ModelPerFieldToJson.value(endBefore as String) + _$ModelPerFieldToJson.value(endBefore as String), ], endBeforeDocumentSnapshot: null, ); @@ -1814,9 +1825,7 @@ class ModelDocumentSnapshot extends FirestoreDocumentSnapshot { @override ModelDocumentReference get reference { - return ModelDocumentReference( - snapshot.reference, - ); + return ModelDocumentReference(snapshot.reference); } @override @@ -1825,33 +1834,20 @@ class ModelDocumentSnapshot extends FirestoreDocumentSnapshot { class ModelQuerySnapshot extends FirestoreQuerySnapshot { - ModelQuerySnapshot._( - this.snapshot, - this.docs, - this.docChanges, - ); - - factory ModelQuerySnapshot._fromQuerySnapshot( - QuerySnapshot snapshot, - ) { + ModelQuerySnapshot._(this.snapshot, this.docs, this.docChanges); + + factory ModelQuerySnapshot._fromQuerySnapshot(QuerySnapshot snapshot) { final docs = snapshot.docs.map(ModelQueryDocumentSnapshot._).toList(); final docChanges = snapshot.docChanges.map((change) { - return _decodeDocumentChange( - change, - ModelDocumentSnapshot._, - ); + return _decodeDocumentChange(change, ModelDocumentSnapshot._); }).toList(); - return ModelQuerySnapshot._( - snapshot, - docs, - docChanges, - ); + return ModelQuerySnapshot._(snapshot, docs, docChanges); } static FirestoreDocumentChange - _decodeDocumentChange( + _decodeDocumentChange( DocumentChange docChange, ModelDocumentSnapshot Function(DocumentSnapshot doc) decodeDoc, ) { @@ -1895,9 +1891,8 @@ abstract class NestedCollectionReference implements NestedQuery, FirestoreCollectionReference { - factory NestedCollectionReference([ - FirebaseFirestore? firestore, - ]) = _$NestedCollectionReference; + factory NestedCollectionReference([FirebaseFirestore? firestore]) = + _$NestedCollectionReference; static Nested fromFirestore( DocumentSnapshot> snapshot, @@ -1906,10 +1901,7 @@ abstract class NestedCollectionReference return Nested.fromJson(snapshot.data()!); } - static Map toFirestore( - Nested value, - SetOptions? options, - ) { + static Map toFirestore(Nested value, SetOptions? options) { return value.toJson(); } @@ -1930,16 +1922,17 @@ class _$NestedCollectionReference extends _$NestedQuery firestore ??= FirebaseFirestore.instance; return _$NestedCollectionReference._( - firestore.collection('nested').withConverter( + firestore + .collection('nested') + .withConverter( fromFirestore: NestedCollectionReference.fromFirestore, toFirestore: NestedCollectionReference.toFirestore, ), ); } - _$NestedCollectionReference._( - CollectionReference reference, - ) : super(reference, $referenceWithoutCursor: reference); + _$NestedCollectionReference._(CollectionReference reference) + : super(reference, $referenceWithoutCursor: reference); String get path => reference.path; @@ -1953,9 +1946,7 @@ class _$NestedCollectionReference extends _$NestedQuery id == null || id.split('/').length == 1, 'The document ID cannot be from a different collection', ); - return NestedDocumentReference( - reference.doc(id), - ); + return NestedDocumentReference(reference.doc(id)); } @override @@ -2221,28 +2212,40 @@ class _$NestedDocumentReference final json = { ...model.toJson(), if (valueFieldValue != null) _$NestedFieldMap['value']!: valueFieldValue, + if (simpleFieldValue != null) _$NestedFieldMap['simple']!: simpleFieldValue, + if (valueListFieldValue != null) _$NestedFieldMap['valueList']!: valueListFieldValue, + if (boolListFieldValue != null) _$NestedFieldMap['boolList']!: boolListFieldValue, + if (stringListFieldValue != null) _$NestedFieldMap['stringList']!: stringListFieldValue, + if (numListFieldValue != null) _$NestedFieldMap['numList']!: numListFieldValue, + if (objectListFieldValue != null) _$NestedFieldMap['objectList']!: objectListFieldValue, + if (dynamicListFieldValue != null) _$NestedFieldMap['dynamicList']!: dynamicListFieldValue, + if (boolSetFieldValue != null) _$NestedFieldMap['boolSet']!: boolSetFieldValue, + if (enumValueFieldValue != null) _$NestedFieldMap['enumValue']!: enumValueFieldValue, + if (nullableEnumValueFieldValue != null) _$NestedFieldMap['nullableEnumValue']!: nullableEnumValueFieldValue, + if (enumListFieldValue != null) _$NestedFieldMap['enumList']!: enumListFieldValue, + if (nullableEnumListFieldValue != null) _$NestedFieldMap['nullableEnumList']!: nullableEnumListFieldValue, }; @@ -2275,28 +2278,40 @@ class _$NestedDocumentReference final json = { ...model.toJson(), if (valueFieldValue != null) _$NestedFieldMap['value']!: valueFieldValue, + if (simpleFieldValue != null) _$NestedFieldMap['simple']!: simpleFieldValue, + if (valueListFieldValue != null) _$NestedFieldMap['valueList']!: valueListFieldValue, + if (boolListFieldValue != null) _$NestedFieldMap['boolList']!: boolListFieldValue, + if (stringListFieldValue != null) _$NestedFieldMap['stringList']!: stringListFieldValue, + if (numListFieldValue != null) _$NestedFieldMap['numList']!: numListFieldValue, + if (objectListFieldValue != null) _$NestedFieldMap['objectList']!: objectListFieldValue, + if (dynamicListFieldValue != null) _$NestedFieldMap['dynamicList']!: dynamicListFieldValue, + if (boolSetFieldValue != null) _$NestedFieldMap['boolSet']!: boolSetFieldValue, + if (enumValueFieldValue != null) _$NestedFieldMap['enumValue']!: enumValueFieldValue, + if (nullableEnumValueFieldValue != null) _$NestedFieldMap['nullableEnumValue']!: nullableEnumValueFieldValue, + if (enumListFieldValue != null) _$NestedFieldMap['enumList']!: enumListFieldValue, + if (nullableEnumListFieldValue != null) _$NestedFieldMap['nullableEnumList']!: nullableEnumListFieldValue, }; @@ -2329,28 +2344,40 @@ class _$NestedDocumentReference final json = { ...model.toJson(), if (valueFieldValue != null) _$NestedFieldMap['value']!: valueFieldValue, + if (simpleFieldValue != null) _$NestedFieldMap['simple']!: simpleFieldValue, + if (valueListFieldValue != null) _$NestedFieldMap['valueList']!: valueListFieldValue, + if (boolListFieldValue != null) _$NestedFieldMap['boolList']!: boolListFieldValue, + if (stringListFieldValue != null) _$NestedFieldMap['stringList']!: stringListFieldValue, + if (numListFieldValue != null) _$NestedFieldMap['numList']!: numListFieldValue, + if (objectListFieldValue != null) _$NestedFieldMap['objectList']!: objectListFieldValue, + if (dynamicListFieldValue != null) _$NestedFieldMap['dynamicList']!: dynamicListFieldValue, + if (boolSetFieldValue != null) _$NestedFieldMap['boolSet']!: boolSetFieldValue, + if (enumValueFieldValue != null) _$NestedFieldMap['enumValue']!: enumValueFieldValue, + if (nullableEnumValueFieldValue != null) _$NestedFieldMap['nullableEnumValue']!: nullableEnumValueFieldValue, + if (enumListFieldValue != null) _$NestedFieldMap['enumList']!: enumListFieldValue, + if (nullableEnumListFieldValue != null) _$NestedFieldMap['nullableEnumList']!: nullableEnumListFieldValue, }; @@ -2444,67 +2471,103 @@ class _$NestedDocumentReference ); final json = { if (value != _sentinel) - _$NestedFieldMap['value']!: - _$NestedPerFieldToJson.value(value as Nested?), + _$NestedFieldMap['value']!: _$NestedPerFieldToJson.value( + value as Nested?, + ), + if (valueFieldValue != null) _$NestedFieldMap['value']!: valueFieldValue, + if (simple != _sentinel) - _$NestedFieldMap['simple']!: - _$NestedPerFieldToJson.simple(simple as int?), + _$NestedFieldMap['simple']!: _$NestedPerFieldToJson.simple( + simple as int?, + ), + if (simpleFieldValue != null) _$NestedFieldMap['simple']!: simpleFieldValue, + if (valueList != _sentinel) - _$NestedFieldMap['valueList']!: - _$NestedPerFieldToJson.valueList(valueList as List?), + _$NestedFieldMap['valueList']!: _$NestedPerFieldToJson.valueList( + valueList as List?, + ), + if (valueListFieldValue != null) _$NestedFieldMap['valueList']!: valueListFieldValue, + if (boolList != _sentinel) - _$NestedFieldMap['boolList']!: - _$NestedPerFieldToJson.boolList(boolList as List?), + _$NestedFieldMap['boolList']!: _$NestedPerFieldToJson.boolList( + boolList as List?, + ), + if (boolListFieldValue != null) _$NestedFieldMap['boolList']!: boolListFieldValue, + if (stringList != _sentinel) - _$NestedFieldMap['stringList']!: - _$NestedPerFieldToJson.stringList(stringList as List?), + _$NestedFieldMap['stringList']!: _$NestedPerFieldToJson.stringList( + stringList as List?, + ), + if (stringListFieldValue != null) _$NestedFieldMap['stringList']!: stringListFieldValue, + if (numList != _sentinel) - _$NestedFieldMap['numList']!: - _$NestedPerFieldToJson.numList(numList as List?), + _$NestedFieldMap['numList']!: _$NestedPerFieldToJson.numList( + numList as List?, + ), + if (numListFieldValue != null) _$NestedFieldMap['numList']!: numListFieldValue, + if (objectList != _sentinel) - _$NestedFieldMap['objectList']!: - _$NestedPerFieldToJson.objectList(objectList as List?), + _$NestedFieldMap['objectList']!: _$NestedPerFieldToJson.objectList( + objectList as List?, + ), + if (objectListFieldValue != null) _$NestedFieldMap['objectList']!: objectListFieldValue, + if (dynamicList != _sentinel) - _$NestedFieldMap['dynamicList']!: - _$NestedPerFieldToJson.dynamicList(dynamicList as List?), + _$NestedFieldMap['dynamicList']!: _$NestedPerFieldToJson.dynamicList( + dynamicList as List?, + ), + if (dynamicListFieldValue != null) _$NestedFieldMap['dynamicList']!: dynamicListFieldValue, + if (boolSet != _sentinel) - _$NestedFieldMap['boolSet']!: - _$NestedPerFieldToJson.boolSet(boolSet as Set?), + _$NestedFieldMap['boolSet']!: _$NestedPerFieldToJson.boolSet( + boolSet as Set?, + ), + if (boolSetFieldValue != null) _$NestedFieldMap['boolSet']!: boolSetFieldValue, + if (enumValue != _sentinel) - _$NestedFieldMap['enumValue']!: - _$NestedPerFieldToJson.enumValue(enumValue as TestEnum), + _$NestedFieldMap['enumValue']!: _$NestedPerFieldToJson.enumValue( + enumValue as TestEnum, + ), + if (enumValueFieldValue != null) _$NestedFieldMap['enumValue']!: enumValueFieldValue, + if (nullableEnumValue != _sentinel) _$NestedFieldMap['nullableEnumValue']!: _$NestedPerFieldToJson .nullableEnumValue(nullableEnumValue as TestEnum?), + if (nullableEnumValueFieldValue != null) _$NestedFieldMap['nullableEnumValue']!: nullableEnumValueFieldValue, + if (enumList != _sentinel) - _$NestedFieldMap['enumList']!: - _$NestedPerFieldToJson.enumList(enumList as List), + _$NestedFieldMap['enumList']!: _$NestedPerFieldToJson.enumList( + enumList as List, + ), + if (enumListFieldValue != null) _$NestedFieldMap['enumList']!: enumListFieldValue, + if (nullableEnumList != _sentinel) _$NestedFieldMap['nullableEnumList']!: _$NestedPerFieldToJson .nullableEnumList(nullableEnumList as List?), + if (nullableEnumListFieldValue != null) _$NestedFieldMap['nullableEnumList']!: nullableEnumListFieldValue, }; @@ -2595,67 +2658,103 @@ class _$NestedDocumentReference ); final json = { if (value != _sentinel) - _$NestedFieldMap['value']!: - _$NestedPerFieldToJson.value(value as Nested?), + _$NestedFieldMap['value']!: _$NestedPerFieldToJson.value( + value as Nested?, + ), + if (valueFieldValue != null) _$NestedFieldMap['value']!: valueFieldValue, + if (simple != _sentinel) - _$NestedFieldMap['simple']!: - _$NestedPerFieldToJson.simple(simple as int?), + _$NestedFieldMap['simple']!: _$NestedPerFieldToJson.simple( + simple as int?, + ), + if (simpleFieldValue != null) _$NestedFieldMap['simple']!: simpleFieldValue, + if (valueList != _sentinel) - _$NestedFieldMap['valueList']!: - _$NestedPerFieldToJson.valueList(valueList as List?), + _$NestedFieldMap['valueList']!: _$NestedPerFieldToJson.valueList( + valueList as List?, + ), + if (valueListFieldValue != null) _$NestedFieldMap['valueList']!: valueListFieldValue, + if (boolList != _sentinel) - _$NestedFieldMap['boolList']!: - _$NestedPerFieldToJson.boolList(boolList as List?), + _$NestedFieldMap['boolList']!: _$NestedPerFieldToJson.boolList( + boolList as List?, + ), + if (boolListFieldValue != null) _$NestedFieldMap['boolList']!: boolListFieldValue, + if (stringList != _sentinel) - _$NestedFieldMap['stringList']!: - _$NestedPerFieldToJson.stringList(stringList as List?), + _$NestedFieldMap['stringList']!: _$NestedPerFieldToJson.stringList( + stringList as List?, + ), + if (stringListFieldValue != null) _$NestedFieldMap['stringList']!: stringListFieldValue, + if (numList != _sentinel) - _$NestedFieldMap['numList']!: - _$NestedPerFieldToJson.numList(numList as List?), + _$NestedFieldMap['numList']!: _$NestedPerFieldToJson.numList( + numList as List?, + ), + if (numListFieldValue != null) _$NestedFieldMap['numList']!: numListFieldValue, + if (objectList != _sentinel) - _$NestedFieldMap['objectList']!: - _$NestedPerFieldToJson.objectList(objectList as List?), + _$NestedFieldMap['objectList']!: _$NestedPerFieldToJson.objectList( + objectList as List?, + ), + if (objectListFieldValue != null) _$NestedFieldMap['objectList']!: objectListFieldValue, + if (dynamicList != _sentinel) - _$NestedFieldMap['dynamicList']!: - _$NestedPerFieldToJson.dynamicList(dynamicList as List?), + _$NestedFieldMap['dynamicList']!: _$NestedPerFieldToJson.dynamicList( + dynamicList as List?, + ), + if (dynamicListFieldValue != null) _$NestedFieldMap['dynamicList']!: dynamicListFieldValue, + if (boolSet != _sentinel) - _$NestedFieldMap['boolSet']!: - _$NestedPerFieldToJson.boolSet(boolSet as Set?), + _$NestedFieldMap['boolSet']!: _$NestedPerFieldToJson.boolSet( + boolSet as Set?, + ), + if (boolSetFieldValue != null) _$NestedFieldMap['boolSet']!: boolSetFieldValue, + if (enumValue != _sentinel) - _$NestedFieldMap['enumValue']!: - _$NestedPerFieldToJson.enumValue(enumValue as TestEnum), + _$NestedFieldMap['enumValue']!: _$NestedPerFieldToJson.enumValue( + enumValue as TestEnum, + ), + if (enumValueFieldValue != null) _$NestedFieldMap['enumValue']!: enumValueFieldValue, + if (nullableEnumValue != _sentinel) _$NestedFieldMap['nullableEnumValue']!: _$NestedPerFieldToJson .nullableEnumValue(nullableEnumValue as TestEnum?), + if (nullableEnumValueFieldValue != null) _$NestedFieldMap['nullableEnumValue']!: nullableEnumValueFieldValue, + if (enumList != _sentinel) - _$NestedFieldMap['enumList']!: - _$NestedPerFieldToJson.enumList(enumList as List), + _$NestedFieldMap['enumList']!: _$NestedPerFieldToJson.enumList( + enumList as List, + ), + if (enumListFieldValue != null) _$NestedFieldMap['enumList']!: enumListFieldValue, + if (nullableEnumList != _sentinel) _$NestedFieldMap['nullableEnumList']!: _$NestedPerFieldToJson .nullableEnumList(nullableEnumList as List?), + if (nullableEnumListFieldValue != null) _$NestedFieldMap['nullableEnumList']!: nullableEnumListFieldValue, }; @@ -2746,67 +2845,103 @@ class _$NestedDocumentReference ); final json = { if (value != _sentinel) - _$NestedFieldMap['value']!: - _$NestedPerFieldToJson.value(value as Nested?), + _$NestedFieldMap['value']!: _$NestedPerFieldToJson.value( + value as Nested?, + ), + if (valueFieldValue != null) _$NestedFieldMap['value']!: valueFieldValue, + if (simple != _sentinel) - _$NestedFieldMap['simple']!: - _$NestedPerFieldToJson.simple(simple as int?), + _$NestedFieldMap['simple']!: _$NestedPerFieldToJson.simple( + simple as int?, + ), + if (simpleFieldValue != null) _$NestedFieldMap['simple']!: simpleFieldValue, + if (valueList != _sentinel) - _$NestedFieldMap['valueList']!: - _$NestedPerFieldToJson.valueList(valueList as List?), + _$NestedFieldMap['valueList']!: _$NestedPerFieldToJson.valueList( + valueList as List?, + ), + if (valueListFieldValue != null) _$NestedFieldMap['valueList']!: valueListFieldValue, + if (boolList != _sentinel) - _$NestedFieldMap['boolList']!: - _$NestedPerFieldToJson.boolList(boolList as List?), + _$NestedFieldMap['boolList']!: _$NestedPerFieldToJson.boolList( + boolList as List?, + ), + if (boolListFieldValue != null) _$NestedFieldMap['boolList']!: boolListFieldValue, + if (stringList != _sentinel) - _$NestedFieldMap['stringList']!: - _$NestedPerFieldToJson.stringList(stringList as List?), + _$NestedFieldMap['stringList']!: _$NestedPerFieldToJson.stringList( + stringList as List?, + ), + if (stringListFieldValue != null) _$NestedFieldMap['stringList']!: stringListFieldValue, + if (numList != _sentinel) - _$NestedFieldMap['numList']!: - _$NestedPerFieldToJson.numList(numList as List?), + _$NestedFieldMap['numList']!: _$NestedPerFieldToJson.numList( + numList as List?, + ), + if (numListFieldValue != null) _$NestedFieldMap['numList']!: numListFieldValue, + if (objectList != _sentinel) - _$NestedFieldMap['objectList']!: - _$NestedPerFieldToJson.objectList(objectList as List?), + _$NestedFieldMap['objectList']!: _$NestedPerFieldToJson.objectList( + objectList as List?, + ), + if (objectListFieldValue != null) _$NestedFieldMap['objectList']!: objectListFieldValue, + if (dynamicList != _sentinel) - _$NestedFieldMap['dynamicList']!: - _$NestedPerFieldToJson.dynamicList(dynamicList as List?), + _$NestedFieldMap['dynamicList']!: _$NestedPerFieldToJson.dynamicList( + dynamicList as List?, + ), + if (dynamicListFieldValue != null) _$NestedFieldMap['dynamicList']!: dynamicListFieldValue, + if (boolSet != _sentinel) - _$NestedFieldMap['boolSet']!: - _$NestedPerFieldToJson.boolSet(boolSet as Set?), + _$NestedFieldMap['boolSet']!: _$NestedPerFieldToJson.boolSet( + boolSet as Set?, + ), + if (boolSetFieldValue != null) _$NestedFieldMap['boolSet']!: boolSetFieldValue, + if (enumValue != _sentinel) - _$NestedFieldMap['enumValue']!: - _$NestedPerFieldToJson.enumValue(enumValue as TestEnum), + _$NestedFieldMap['enumValue']!: _$NestedPerFieldToJson.enumValue( + enumValue as TestEnum, + ), + if (enumValueFieldValue != null) _$NestedFieldMap['enumValue']!: enumValueFieldValue, + if (nullableEnumValue != _sentinel) _$NestedFieldMap['nullableEnumValue']!: _$NestedPerFieldToJson .nullableEnumValue(nullableEnumValue as TestEnum?), + if (nullableEnumValueFieldValue != null) _$NestedFieldMap['nullableEnumValue']!: nullableEnumValueFieldValue, + if (enumList != _sentinel) - _$NestedFieldMap['enumList']!: - _$NestedPerFieldToJson.enumList(enumList as List), + _$NestedFieldMap['enumList']!: _$NestedPerFieldToJson.enumList( + enumList as List, + ), + if (enumListFieldValue != null) _$NestedFieldMap['enumList']!: enumListFieldValue, + if (nullableEnumList != _sentinel) _$NestedFieldMap['nullableEnumList']!: _$NestedPerFieldToJson .nullableEnumList(nullableEnumList as List?), + if (nullableEnumListFieldValue != null) _$NestedFieldMap['nullableEnumList']!: nullableEnumListFieldValue, }; @@ -3243,9 +3378,9 @@ class _$NestedQuery extends QueryReference required Query $referenceWithoutCursor, $QueryCursor $queryCursor = const $QueryCursor(), }) : super( - $referenceWithoutCursor: $referenceWithoutCursor, - $queryCursor: $queryCursor, - ); + $referenceWithoutCursor: $referenceWithoutCursor, + $queryCursor: $queryCursor, + ); final CollectionReference _collection; @@ -3306,7 +3441,8 @@ class _$NestedQuery extends QueryReference arrayContainsAny: arrayContainsAny, whereIn: whereIn, whereNotIn: whereNotIn, - isNull: isNull ?? + isNull: + isNull ?? (isEqualTo == null ? false : null) ?? (isNotEqualTo == null ? true : null), ), @@ -3338,7 +3474,8 @@ class _$NestedQuery extends QueryReference isGreaterThanOrEqualTo: isGreaterThanOrEqualTo, whereIn: whereIn, whereNotIn: whereNotIn, - isNull: isNull ?? + isNull: + isNull ?? (isEqualTo == null ? false : null) ?? (isNotEqualTo == null ? true : null), ), @@ -3382,7 +3519,8 @@ class _$NestedQuery extends QueryReference : null, whereIn: whereIn?.map((e) => _$NestedPerFieldToJson.value(e)), whereNotIn: whereNotIn?.map((e) => _$NestedPerFieldToJson.value(e)), - isNull: isNull ?? + isNull: + isNull ?? (isEqualTo == null ? false : null) ?? (isNotEqualTo == null ? true : null), ), @@ -3426,7 +3564,8 @@ class _$NestedQuery extends QueryReference : null, whereIn: whereIn?.map((e) => _$NestedPerFieldToJson.simple(e)), whereNotIn: whereNotIn?.map((e) => _$NestedPerFieldToJson.simple(e)), - isNull: isNull ?? + isNull: + isNull ?? (isEqualTo == null ? false : null) ?? (isNotEqualTo == null ? true : null), ), @@ -3460,26 +3599,29 @@ class _$NestedQuery extends QueryReference ? _$NestedPerFieldToJson.valueList(isLessThan as List?) : null, isLessThanOrEqualTo: isLessThanOrEqualTo != null - ? _$NestedPerFieldToJson - .valueList(isLessThanOrEqualTo as List?) + ? _$NestedPerFieldToJson.valueList( + isLessThanOrEqualTo as List?, + ) : null, isGreaterThan: isGreaterThan != null ? _$NestedPerFieldToJson.valueList(isGreaterThan as List?) : null, isGreaterThanOrEqualTo: isGreaterThanOrEqualTo != null - ? _$NestedPerFieldToJson - .valueList(isGreaterThanOrEqualTo as List?) + ? _$NestedPerFieldToJson.valueList( + isGreaterThanOrEqualTo as List?, + ) : null, arrayContains: arrayContains != null ? (_$NestedPerFieldToJson.valueList([arrayContains as Nested]) - as List?)! - .single + as List?)! + .single : null, arrayContainsAny: arrayContainsAny != null ? _$NestedPerFieldToJson.valueList(arrayContainsAny) - as Iterable? + as Iterable? : null, - isNull: isNull ?? + isNull: + isNull ?? (isEqualTo == null ? false : null) ?? (isNotEqualTo == null ? true : null), ), @@ -3513,26 +3655,29 @@ class _$NestedQuery extends QueryReference ? _$NestedPerFieldToJson.boolList(isLessThan as List?) : null, isLessThanOrEqualTo: isLessThanOrEqualTo != null - ? _$NestedPerFieldToJson - .boolList(isLessThanOrEqualTo as List?) + ? _$NestedPerFieldToJson.boolList( + isLessThanOrEqualTo as List?, + ) : null, isGreaterThan: isGreaterThan != null ? _$NestedPerFieldToJson.boolList(isGreaterThan as List?) : null, isGreaterThanOrEqualTo: isGreaterThanOrEqualTo != null - ? _$NestedPerFieldToJson - .boolList(isGreaterThanOrEqualTo as List?) + ? _$NestedPerFieldToJson.boolList( + isGreaterThanOrEqualTo as List?, + ) : null, arrayContains: arrayContains != null ? (_$NestedPerFieldToJson.boolList([arrayContains as bool]) - as List?)! - .single + as List?)! + .single : null, arrayContainsAny: arrayContainsAny != null ? _$NestedPerFieldToJson.boolList(arrayContainsAny) - as Iterable? + as Iterable? : null, - isNull: isNull ?? + isNull: + isNull ?? (isEqualTo == null ? false : null) ?? (isNotEqualTo == null ? true : null), ), @@ -3566,26 +3711,29 @@ class _$NestedQuery extends QueryReference ? _$NestedPerFieldToJson.stringList(isLessThan as List?) : null, isLessThanOrEqualTo: isLessThanOrEqualTo != null - ? _$NestedPerFieldToJson - .stringList(isLessThanOrEqualTo as List?) + ? _$NestedPerFieldToJson.stringList( + isLessThanOrEqualTo as List?, + ) : null, isGreaterThan: isGreaterThan != null ? _$NestedPerFieldToJson.stringList(isGreaterThan as List?) : null, isGreaterThanOrEqualTo: isGreaterThanOrEqualTo != null - ? _$NestedPerFieldToJson - .stringList(isGreaterThanOrEqualTo as List?) + ? _$NestedPerFieldToJson.stringList( + isGreaterThanOrEqualTo as List?, + ) : null, arrayContains: arrayContains != null ? (_$NestedPerFieldToJson.stringList([arrayContains as String]) - as List?)! - .single + as List?)! + .single : null, arrayContainsAny: arrayContainsAny != null ? _$NestedPerFieldToJson.stringList(arrayContainsAny) - as Iterable? + as Iterable? : null, - isNull: isNull ?? + isNull: + isNull ?? (isEqualTo == null ? false : null) ?? (isNotEqualTo == null ? true : null), ), @@ -3625,18 +3773,20 @@ class _$NestedQuery extends QueryReference ? _$NestedPerFieldToJson.numList(isGreaterThan as List?) : null, isGreaterThanOrEqualTo: isGreaterThanOrEqualTo != null - ? _$NestedPerFieldToJson - .numList(isGreaterThanOrEqualTo as List?) + ? _$NestedPerFieldToJson.numList( + isGreaterThanOrEqualTo as List?, + ) : null, arrayContains: arrayContains != null ? (_$NestedPerFieldToJson.numList([arrayContains as num]) as List?)! - .single + .single : null, arrayContainsAny: arrayContainsAny != null ? _$NestedPerFieldToJson.numList(arrayContainsAny) - as Iterable? + as Iterable? : null, - isNull: isNull ?? + isNull: + isNull ?? (isEqualTo == null ? false : null) ?? (isNotEqualTo == null ? true : null), ), @@ -3670,25 +3820,28 @@ class _$NestedQuery extends QueryReference ? _$NestedPerFieldToJson.objectList(isLessThan as List?) : null, isLessThanOrEqualTo: isLessThanOrEqualTo != null - ? _$NestedPerFieldToJson - .objectList(isLessThanOrEqualTo as List?) + ? _$NestedPerFieldToJson.objectList( + isLessThanOrEqualTo as List?, + ) : null, isGreaterThan: isGreaterThan != null ? _$NestedPerFieldToJson.objectList(isGreaterThan as List?) : null, isGreaterThanOrEqualTo: isGreaterThanOrEqualTo != null - ? _$NestedPerFieldToJson - .objectList(isGreaterThanOrEqualTo as List?) + ? _$NestedPerFieldToJson.objectList( + isGreaterThanOrEqualTo as List?, + ) : null, arrayContains: arrayContains != null ? (_$NestedPerFieldToJson.objectList([arrayContains]) as List?)! - .single + .single : null, arrayContainsAny: arrayContainsAny != null ? _$NestedPerFieldToJson.objectList(arrayContainsAny) - as Iterable? + as Iterable? : null, - isNull: isNull ?? + isNull: + isNull ?? (isEqualTo == null ? false : null) ?? (isNotEqualTo == null ? true : null), ), @@ -3722,27 +3875,31 @@ class _$NestedQuery extends QueryReference ? _$NestedPerFieldToJson.dynamicList(isLessThan as List?) : null, isLessThanOrEqualTo: isLessThanOrEqualTo != null - ? _$NestedPerFieldToJson - .dynamicList(isLessThanOrEqualTo as List?) + ? _$NestedPerFieldToJson.dynamicList( + isLessThanOrEqualTo as List?, + ) : null, isGreaterThan: isGreaterThan != null - ? _$NestedPerFieldToJson - .dynamicList(isGreaterThan as List?) + ? _$NestedPerFieldToJson.dynamicList( + isGreaterThan as List?, + ) : null, isGreaterThanOrEqualTo: isGreaterThanOrEqualTo != null - ? _$NestedPerFieldToJson - .dynamicList(isGreaterThanOrEqualTo as List?) + ? _$NestedPerFieldToJson.dynamicList( + isGreaterThanOrEqualTo as List?, + ) : null, arrayContains: arrayContains != null ? (_$NestedPerFieldToJson.dynamicList([arrayContains as dynamic]) - as List?)! - .single + as List?)! + .single : null, arrayContainsAny: arrayContainsAny != null ? _$NestedPerFieldToJson.dynamicList(arrayContainsAny) - as Iterable? + as Iterable? : null, - isNull: isNull ?? + isNull: + isNull ?? (isEqualTo == null ? false : null) ?? (isNotEqualTo == null ? true : null), ), @@ -3782,19 +3939,21 @@ class _$NestedQuery extends QueryReference ? _$NestedPerFieldToJson.boolSet(isGreaterThan as Set?) : null, isGreaterThanOrEqualTo: isGreaterThanOrEqualTo != null - ? _$NestedPerFieldToJson - .boolSet(isGreaterThanOrEqualTo as Set?) + ? _$NestedPerFieldToJson.boolSet( + isGreaterThanOrEqualTo as Set?, + ) : null, arrayContains: arrayContains != null ? (_$NestedPerFieldToJson.boolSet({arrayContains as bool}) - as List?)! - .single + as List?)! + .single : null, arrayContainsAny: arrayContainsAny != null ? _$NestedPerFieldToJson.boolSet(arrayContainsAny) - as Iterable? + as Iterable? : null, - isNull: isNull ?? + isNull: + isNull ?? (isEqualTo == null ? false : null) ?? (isNotEqualTo == null ? true : null), ), @@ -3834,12 +3993,14 @@ class _$NestedQuery extends QueryReference ? _$NestedPerFieldToJson.enumValue(isGreaterThan as TestEnum) : null, isGreaterThanOrEqualTo: isGreaterThanOrEqualTo != null - ? _$NestedPerFieldToJson - .enumValue(isGreaterThanOrEqualTo as TestEnum) + ? _$NestedPerFieldToJson.enumValue( + isGreaterThanOrEqualTo as TestEnum, + ) : null, whereIn: whereIn?.map((e) => _$NestedPerFieldToJson.enumValue(e)), whereNotIn: whereNotIn?.map((e) => _$NestedPerFieldToJson.enumValue(e)), - isNull: isNull ?? + isNull: + isNull ?? (isEqualTo == null ? false : null) ?? (isNotEqualTo == null ? true : null), ), @@ -3867,29 +4028,36 @@ class _$NestedQuery extends QueryReference ? _$NestedPerFieldToJson.nullableEnumValue(isEqualTo as TestEnum?) : null, isNotEqualTo: isNotEqualTo != _sentinel - ? _$NestedPerFieldToJson - .nullableEnumValue(isNotEqualTo as TestEnum?) + ? _$NestedPerFieldToJson.nullableEnumValue( + isNotEqualTo as TestEnum?, + ) : null, isLessThan: isLessThan != null ? _$NestedPerFieldToJson.nullableEnumValue(isLessThan as TestEnum?) : null, isLessThanOrEqualTo: isLessThanOrEqualTo != null - ? _$NestedPerFieldToJson - .nullableEnumValue(isLessThanOrEqualTo as TestEnum?) + ? _$NestedPerFieldToJson.nullableEnumValue( + isLessThanOrEqualTo as TestEnum?, + ) : null, isGreaterThan: isGreaterThan != null - ? _$NestedPerFieldToJson - .nullableEnumValue(isGreaterThan as TestEnum?) + ? _$NestedPerFieldToJson.nullableEnumValue( + isGreaterThan as TestEnum?, + ) : null, isGreaterThanOrEqualTo: isGreaterThanOrEqualTo != null - ? _$NestedPerFieldToJson - .nullableEnumValue(isGreaterThanOrEqualTo as TestEnum?) - : null, - whereIn: - whereIn?.map((e) => _$NestedPerFieldToJson.nullableEnumValue(e)), - whereNotIn: - whereNotIn?.map((e) => _$NestedPerFieldToJson.nullableEnumValue(e)), - isNull: isNull ?? + ? _$NestedPerFieldToJson.nullableEnumValue( + isGreaterThanOrEqualTo as TestEnum?, + ) + : null, + whereIn: whereIn?.map( + (e) => _$NestedPerFieldToJson.nullableEnumValue(e), + ), + whereNotIn: whereNotIn?.map( + (e) => _$NestedPerFieldToJson.nullableEnumValue(e), + ), + isNull: + isNull ?? (isEqualTo == null ? false : null) ?? (isNotEqualTo == null ? true : null), ), @@ -3923,26 +4091,29 @@ class _$NestedQuery extends QueryReference ? _$NestedPerFieldToJson.enumList(isLessThan as List) : null, isLessThanOrEqualTo: isLessThanOrEqualTo != null - ? _$NestedPerFieldToJson - .enumList(isLessThanOrEqualTo as List) + ? _$NestedPerFieldToJson.enumList( + isLessThanOrEqualTo as List, + ) : null, isGreaterThan: isGreaterThan != null ? _$NestedPerFieldToJson.enumList(isGreaterThan as List) : null, isGreaterThanOrEqualTo: isGreaterThanOrEqualTo != null - ? _$NestedPerFieldToJson - .enumList(isGreaterThanOrEqualTo as List) + ? _$NestedPerFieldToJson.enumList( + isGreaterThanOrEqualTo as List, + ) : null, arrayContains: arrayContains != null ? (_$NestedPerFieldToJson.enumList([arrayContains as TestEnum]) - as List?)! - .single + as List?)! + .single : null, arrayContainsAny: arrayContainsAny != null ? _$NestedPerFieldToJson.enumList(arrayContainsAny) - as Iterable? + as Iterable? : null, - isNull: isNull ?? + isNull: + isNull ?? (isEqualTo == null ? false : null) ?? (isNotEqualTo == null ? true : null), ), @@ -3967,39 +4138,48 @@ class _$NestedQuery extends QueryReference $referenceWithoutCursor: $referenceWithoutCursor.where( _$NestedFieldMap['nullableEnumList']!, isEqualTo: isEqualTo != _sentinel - ? _$NestedPerFieldToJson - .nullableEnumList(isEqualTo as List?) + ? _$NestedPerFieldToJson.nullableEnumList( + isEqualTo as List?, + ) : null, isNotEqualTo: isNotEqualTo != _sentinel - ? _$NestedPerFieldToJson - .nullableEnumList(isNotEqualTo as List?) + ? _$NestedPerFieldToJson.nullableEnumList( + isNotEqualTo as List?, + ) : null, isLessThan: isLessThan != null - ? _$NestedPerFieldToJson - .nullableEnumList(isLessThan as List?) + ? _$NestedPerFieldToJson.nullableEnumList( + isLessThan as List?, + ) : null, isLessThanOrEqualTo: isLessThanOrEqualTo != null - ? _$NestedPerFieldToJson - .nullableEnumList(isLessThanOrEqualTo as List?) + ? _$NestedPerFieldToJson.nullableEnumList( + isLessThanOrEqualTo as List?, + ) : null, isGreaterThan: isGreaterThan != null - ? _$NestedPerFieldToJson - .nullableEnumList(isGreaterThan as List?) + ? _$NestedPerFieldToJson.nullableEnumList( + isGreaterThan as List?, + ) : null, isGreaterThanOrEqualTo: isGreaterThanOrEqualTo != null - ? _$NestedPerFieldToJson - .nullableEnumList(isGreaterThanOrEqualTo as List?) + ? _$NestedPerFieldToJson.nullableEnumList( + isGreaterThanOrEqualTo as List?, + ) : null, arrayContains: arrayContains != null - ? (_$NestedPerFieldToJson - .nullableEnumList([arrayContains as TestEnum]) as List?)! - .single + ? (_$NestedPerFieldToJson.nullableEnumList([ + arrayContains as TestEnum, + ]) + as List?)! + .single : null, arrayContainsAny: arrayContainsAny != null ? _$NestedPerFieldToJson.nullableEnumList(arrayContainsAny) - as Iterable? + as Iterable? : null, - isNull: isNull ?? + isNull: + isNull ?? (isEqualTo == null ? false : null) ?? (isNotEqualTo == null ? true : null), ), @@ -4020,8 +4200,10 @@ class _$NestedQuery extends QueryReference NestedDocumentSnapshot? endBeforeDocument, NestedDocumentSnapshot? startAfterDocument, }) { - final query = - $referenceWithoutCursor.orderBy(fieldPath, descending: descending); + final query = $referenceWithoutCursor.orderBy( + fieldPath, + descending: descending, + ); var queryCursor = $queryCursor; if (startAtDocument != null) { @@ -4093,8 +4275,10 @@ class _$NestedQuery extends QueryReference NestedDocumentSnapshot? endBeforeDocument, NestedDocumentSnapshot? startAfterDocument, }) { - final query = $referenceWithoutCursor.orderBy(FieldPath.documentId, - descending: descending); + final query = $referenceWithoutCursor.orderBy( + FieldPath.documentId, + descending: descending, + ); var queryCursor = $queryCursor; if (startAtDocument != null) { @@ -4166,8 +4350,10 @@ class _$NestedQuery extends QueryReference NestedDocumentSnapshot? endBeforeDocument, NestedDocumentSnapshot? startAfterDocument, }) { - final query = $referenceWithoutCursor.orderBy(_$NestedFieldMap['value']!, - descending: descending); + final query = $referenceWithoutCursor.orderBy( + _$NestedFieldMap['value']!, + descending: descending, + ); var queryCursor = $queryCursor; if (startAtDocument != null) { @@ -4199,7 +4385,7 @@ class _$NestedQuery extends QueryReference queryCursor = queryCursor.copyWith( startAt: [ ...queryCursor.startAt, - _$NestedPerFieldToJson.value(startAt as Nested?) + _$NestedPerFieldToJson.value(startAt as Nested?), ], startAtDocumentSnapshot: null, ); @@ -4208,7 +4394,7 @@ class _$NestedQuery extends QueryReference queryCursor = queryCursor.copyWith( startAfter: [ ...queryCursor.startAfter, - _$NestedPerFieldToJson.value(startAfter as Nested?) + _$NestedPerFieldToJson.value(startAfter as Nested?), ], startAfterDocumentSnapshot: null, ); @@ -4217,7 +4403,7 @@ class _$NestedQuery extends QueryReference queryCursor = queryCursor.copyWith( endAt: [ ...queryCursor.endAt, - _$NestedPerFieldToJson.value(endAt as Nested?) + _$NestedPerFieldToJson.value(endAt as Nested?), ], endAtDocumentSnapshot: null, ); @@ -4226,7 +4412,7 @@ class _$NestedQuery extends QueryReference queryCursor = queryCursor.copyWith( endBefore: [ ...queryCursor.endBefore, - _$NestedPerFieldToJson.value(endBefore as Nested?) + _$NestedPerFieldToJson.value(endBefore as Nested?), ], endBeforeDocumentSnapshot: null, ); @@ -4251,8 +4437,10 @@ class _$NestedQuery extends QueryReference NestedDocumentSnapshot? endBeforeDocument, NestedDocumentSnapshot? startAfterDocument, }) { - final query = $referenceWithoutCursor.orderBy(_$NestedFieldMap['simple']!, - descending: descending); + final query = $referenceWithoutCursor.orderBy( + _$NestedFieldMap['simple']!, + descending: descending, + ); var queryCursor = $queryCursor; if (startAtDocument != null) { @@ -4284,7 +4472,7 @@ class _$NestedQuery extends QueryReference queryCursor = queryCursor.copyWith( startAt: [ ...queryCursor.startAt, - _$NestedPerFieldToJson.simple(startAt as int?) + _$NestedPerFieldToJson.simple(startAt as int?), ], startAtDocumentSnapshot: null, ); @@ -4293,7 +4481,7 @@ class _$NestedQuery extends QueryReference queryCursor = queryCursor.copyWith( startAfter: [ ...queryCursor.startAfter, - _$NestedPerFieldToJson.simple(startAfter as int?) + _$NestedPerFieldToJson.simple(startAfter as int?), ], startAfterDocumentSnapshot: null, ); @@ -4302,7 +4490,7 @@ class _$NestedQuery extends QueryReference queryCursor = queryCursor.copyWith( endAt: [ ...queryCursor.endAt, - _$NestedPerFieldToJson.simple(endAt as int?) + _$NestedPerFieldToJson.simple(endAt as int?), ], endAtDocumentSnapshot: null, ); @@ -4311,7 +4499,7 @@ class _$NestedQuery extends QueryReference queryCursor = queryCursor.copyWith( endBefore: [ ...queryCursor.endBefore, - _$NestedPerFieldToJson.simple(endBefore as int?) + _$NestedPerFieldToJson.simple(endBefore as int?), ], endBeforeDocumentSnapshot: null, ); @@ -4336,8 +4524,10 @@ class _$NestedQuery extends QueryReference NestedDocumentSnapshot? endBeforeDocument, NestedDocumentSnapshot? startAfterDocument, }) { - final query = $referenceWithoutCursor - .orderBy(_$NestedFieldMap['valueList']!, descending: descending); + final query = $referenceWithoutCursor.orderBy( + _$NestedFieldMap['valueList']!, + descending: descending, + ); var queryCursor = $queryCursor; if (startAtDocument != null) { @@ -4369,7 +4559,7 @@ class _$NestedQuery extends QueryReference queryCursor = queryCursor.copyWith( startAt: [ ...queryCursor.startAt, - _$NestedPerFieldToJson.valueList(startAt as List?) + _$NestedPerFieldToJson.valueList(startAt as List?), ], startAtDocumentSnapshot: null, ); @@ -4378,7 +4568,7 @@ class _$NestedQuery extends QueryReference queryCursor = queryCursor.copyWith( startAfter: [ ...queryCursor.startAfter, - _$NestedPerFieldToJson.valueList(startAfter as List?) + _$NestedPerFieldToJson.valueList(startAfter as List?), ], startAfterDocumentSnapshot: null, ); @@ -4387,7 +4577,7 @@ class _$NestedQuery extends QueryReference queryCursor = queryCursor.copyWith( endAt: [ ...queryCursor.endAt, - _$NestedPerFieldToJson.valueList(endAt as List?) + _$NestedPerFieldToJson.valueList(endAt as List?), ], endAtDocumentSnapshot: null, ); @@ -4396,7 +4586,7 @@ class _$NestedQuery extends QueryReference queryCursor = queryCursor.copyWith( endBefore: [ ...queryCursor.endBefore, - _$NestedPerFieldToJson.valueList(endBefore as List?) + _$NestedPerFieldToJson.valueList(endBefore as List?), ], endBeforeDocumentSnapshot: null, ); @@ -4421,8 +4611,10 @@ class _$NestedQuery extends QueryReference NestedDocumentSnapshot? endBeforeDocument, NestedDocumentSnapshot? startAfterDocument, }) { - final query = $referenceWithoutCursor.orderBy(_$NestedFieldMap['boolList']!, - descending: descending); + final query = $referenceWithoutCursor.orderBy( + _$NestedFieldMap['boolList']!, + descending: descending, + ); var queryCursor = $queryCursor; if (startAtDocument != null) { @@ -4454,7 +4646,7 @@ class _$NestedQuery extends QueryReference queryCursor = queryCursor.copyWith( startAt: [ ...queryCursor.startAt, - _$NestedPerFieldToJson.boolList(startAt as List?) + _$NestedPerFieldToJson.boolList(startAt as List?), ], startAtDocumentSnapshot: null, ); @@ -4463,7 +4655,7 @@ class _$NestedQuery extends QueryReference queryCursor = queryCursor.copyWith( startAfter: [ ...queryCursor.startAfter, - _$NestedPerFieldToJson.boolList(startAfter as List?) + _$NestedPerFieldToJson.boolList(startAfter as List?), ], startAfterDocumentSnapshot: null, ); @@ -4472,7 +4664,7 @@ class _$NestedQuery extends QueryReference queryCursor = queryCursor.copyWith( endAt: [ ...queryCursor.endAt, - _$NestedPerFieldToJson.boolList(endAt as List?) + _$NestedPerFieldToJson.boolList(endAt as List?), ], endAtDocumentSnapshot: null, ); @@ -4481,7 +4673,7 @@ class _$NestedQuery extends QueryReference queryCursor = queryCursor.copyWith( endBefore: [ ...queryCursor.endBefore, - _$NestedPerFieldToJson.boolList(endBefore as List?) + _$NestedPerFieldToJson.boolList(endBefore as List?), ], endBeforeDocumentSnapshot: null, ); @@ -4506,8 +4698,10 @@ class _$NestedQuery extends QueryReference NestedDocumentSnapshot? endBeforeDocument, NestedDocumentSnapshot? startAfterDocument, }) { - final query = $referenceWithoutCursor - .orderBy(_$NestedFieldMap['stringList']!, descending: descending); + final query = $referenceWithoutCursor.orderBy( + _$NestedFieldMap['stringList']!, + descending: descending, + ); var queryCursor = $queryCursor; if (startAtDocument != null) { @@ -4539,7 +4733,7 @@ class _$NestedQuery extends QueryReference queryCursor = queryCursor.copyWith( startAt: [ ...queryCursor.startAt, - _$NestedPerFieldToJson.stringList(startAt as List?) + _$NestedPerFieldToJson.stringList(startAt as List?), ], startAtDocumentSnapshot: null, ); @@ -4548,7 +4742,7 @@ class _$NestedQuery extends QueryReference queryCursor = queryCursor.copyWith( startAfter: [ ...queryCursor.startAfter, - _$NestedPerFieldToJson.stringList(startAfter as List?) + _$NestedPerFieldToJson.stringList(startAfter as List?), ], startAfterDocumentSnapshot: null, ); @@ -4557,7 +4751,7 @@ class _$NestedQuery extends QueryReference queryCursor = queryCursor.copyWith( endAt: [ ...queryCursor.endAt, - _$NestedPerFieldToJson.stringList(endAt as List?) + _$NestedPerFieldToJson.stringList(endAt as List?), ], endAtDocumentSnapshot: null, ); @@ -4566,7 +4760,7 @@ class _$NestedQuery extends QueryReference queryCursor = queryCursor.copyWith( endBefore: [ ...queryCursor.endBefore, - _$NestedPerFieldToJson.stringList(endBefore as List?) + _$NestedPerFieldToJson.stringList(endBefore as List?), ], endBeforeDocumentSnapshot: null, ); @@ -4591,8 +4785,10 @@ class _$NestedQuery extends QueryReference NestedDocumentSnapshot? endBeforeDocument, NestedDocumentSnapshot? startAfterDocument, }) { - final query = $referenceWithoutCursor.orderBy(_$NestedFieldMap['numList']!, - descending: descending); + final query = $referenceWithoutCursor.orderBy( + _$NestedFieldMap['numList']!, + descending: descending, + ); var queryCursor = $queryCursor; if (startAtDocument != null) { @@ -4624,7 +4820,7 @@ class _$NestedQuery extends QueryReference queryCursor = queryCursor.copyWith( startAt: [ ...queryCursor.startAt, - _$NestedPerFieldToJson.numList(startAt as List?) + _$NestedPerFieldToJson.numList(startAt as List?), ], startAtDocumentSnapshot: null, ); @@ -4633,7 +4829,7 @@ class _$NestedQuery extends QueryReference queryCursor = queryCursor.copyWith( startAfter: [ ...queryCursor.startAfter, - _$NestedPerFieldToJson.numList(startAfter as List?) + _$NestedPerFieldToJson.numList(startAfter as List?), ], startAfterDocumentSnapshot: null, ); @@ -4642,7 +4838,7 @@ class _$NestedQuery extends QueryReference queryCursor = queryCursor.copyWith( endAt: [ ...queryCursor.endAt, - _$NestedPerFieldToJson.numList(endAt as List?) + _$NestedPerFieldToJson.numList(endAt as List?), ], endAtDocumentSnapshot: null, ); @@ -4651,7 +4847,7 @@ class _$NestedQuery extends QueryReference queryCursor = queryCursor.copyWith( endBefore: [ ...queryCursor.endBefore, - _$NestedPerFieldToJson.numList(endBefore as List?) + _$NestedPerFieldToJson.numList(endBefore as List?), ], endBeforeDocumentSnapshot: null, ); @@ -4676,8 +4872,10 @@ class _$NestedQuery extends QueryReference NestedDocumentSnapshot? endBeforeDocument, NestedDocumentSnapshot? startAfterDocument, }) { - final query = $referenceWithoutCursor - .orderBy(_$NestedFieldMap['objectList']!, descending: descending); + final query = $referenceWithoutCursor.orderBy( + _$NestedFieldMap['objectList']!, + descending: descending, + ); var queryCursor = $queryCursor; if (startAtDocument != null) { @@ -4709,7 +4907,7 @@ class _$NestedQuery extends QueryReference queryCursor = queryCursor.copyWith( startAt: [ ...queryCursor.startAt, - _$NestedPerFieldToJson.objectList(startAt as List?) + _$NestedPerFieldToJson.objectList(startAt as List?), ], startAtDocumentSnapshot: null, ); @@ -4718,7 +4916,7 @@ class _$NestedQuery extends QueryReference queryCursor = queryCursor.copyWith( startAfter: [ ...queryCursor.startAfter, - _$NestedPerFieldToJson.objectList(startAfter as List?) + _$NestedPerFieldToJson.objectList(startAfter as List?), ], startAfterDocumentSnapshot: null, ); @@ -4727,7 +4925,7 @@ class _$NestedQuery extends QueryReference queryCursor = queryCursor.copyWith( endAt: [ ...queryCursor.endAt, - _$NestedPerFieldToJson.objectList(endAt as List?) + _$NestedPerFieldToJson.objectList(endAt as List?), ], endAtDocumentSnapshot: null, ); @@ -4736,7 +4934,7 @@ class _$NestedQuery extends QueryReference queryCursor = queryCursor.copyWith( endBefore: [ ...queryCursor.endBefore, - _$NestedPerFieldToJson.objectList(endBefore as List?) + _$NestedPerFieldToJson.objectList(endBefore as List?), ], endBeforeDocumentSnapshot: null, ); @@ -4761,8 +4959,10 @@ class _$NestedQuery extends QueryReference NestedDocumentSnapshot? endBeforeDocument, NestedDocumentSnapshot? startAfterDocument, }) { - final query = $referenceWithoutCursor - .orderBy(_$NestedFieldMap['dynamicList']!, descending: descending); + final query = $referenceWithoutCursor.orderBy( + _$NestedFieldMap['dynamicList']!, + descending: descending, + ); var queryCursor = $queryCursor; if (startAtDocument != null) { @@ -4794,7 +4994,7 @@ class _$NestedQuery extends QueryReference queryCursor = queryCursor.copyWith( startAt: [ ...queryCursor.startAt, - _$NestedPerFieldToJson.dynamicList(startAt as List?) + _$NestedPerFieldToJson.dynamicList(startAt as List?), ], startAtDocumentSnapshot: null, ); @@ -4803,7 +5003,7 @@ class _$NestedQuery extends QueryReference queryCursor = queryCursor.copyWith( startAfter: [ ...queryCursor.startAfter, - _$NestedPerFieldToJson.dynamicList(startAfter as List?) + _$NestedPerFieldToJson.dynamicList(startAfter as List?), ], startAfterDocumentSnapshot: null, ); @@ -4812,7 +5012,7 @@ class _$NestedQuery extends QueryReference queryCursor = queryCursor.copyWith( endAt: [ ...queryCursor.endAt, - _$NestedPerFieldToJson.dynamicList(endAt as List?) + _$NestedPerFieldToJson.dynamicList(endAt as List?), ], endAtDocumentSnapshot: null, ); @@ -4821,7 +5021,7 @@ class _$NestedQuery extends QueryReference queryCursor = queryCursor.copyWith( endBefore: [ ...queryCursor.endBefore, - _$NestedPerFieldToJson.dynamicList(endBefore as List?) + _$NestedPerFieldToJson.dynamicList(endBefore as List?), ], endBeforeDocumentSnapshot: null, ); @@ -4846,8 +5046,10 @@ class _$NestedQuery extends QueryReference NestedDocumentSnapshot? endBeforeDocument, NestedDocumentSnapshot? startAfterDocument, }) { - final query = $referenceWithoutCursor.orderBy(_$NestedFieldMap['boolSet']!, - descending: descending); + final query = $referenceWithoutCursor.orderBy( + _$NestedFieldMap['boolSet']!, + descending: descending, + ); var queryCursor = $queryCursor; if (startAtDocument != null) { @@ -4879,7 +5081,7 @@ class _$NestedQuery extends QueryReference queryCursor = queryCursor.copyWith( startAt: [ ...queryCursor.startAt, - _$NestedPerFieldToJson.boolSet(startAt as Set?) + _$NestedPerFieldToJson.boolSet(startAt as Set?), ], startAtDocumentSnapshot: null, ); @@ -4888,7 +5090,7 @@ class _$NestedQuery extends QueryReference queryCursor = queryCursor.copyWith( startAfter: [ ...queryCursor.startAfter, - _$NestedPerFieldToJson.boolSet(startAfter as Set?) + _$NestedPerFieldToJson.boolSet(startAfter as Set?), ], startAfterDocumentSnapshot: null, ); @@ -4897,7 +5099,7 @@ class _$NestedQuery extends QueryReference queryCursor = queryCursor.copyWith( endAt: [ ...queryCursor.endAt, - _$NestedPerFieldToJson.boolSet(endAt as Set?) + _$NestedPerFieldToJson.boolSet(endAt as Set?), ], endAtDocumentSnapshot: null, ); @@ -4906,7 +5108,7 @@ class _$NestedQuery extends QueryReference queryCursor = queryCursor.copyWith( endBefore: [ ...queryCursor.endBefore, - _$NestedPerFieldToJson.boolSet(endBefore as Set?) + _$NestedPerFieldToJson.boolSet(endBefore as Set?), ], endBeforeDocumentSnapshot: null, ); @@ -4931,8 +5133,10 @@ class _$NestedQuery extends QueryReference NestedDocumentSnapshot? endBeforeDocument, NestedDocumentSnapshot? startAfterDocument, }) { - final query = $referenceWithoutCursor - .orderBy(_$NestedFieldMap['enumValue']!, descending: descending); + final query = $referenceWithoutCursor.orderBy( + _$NestedFieldMap['enumValue']!, + descending: descending, + ); var queryCursor = $queryCursor; if (startAtDocument != null) { @@ -4964,7 +5168,7 @@ class _$NestedQuery extends QueryReference queryCursor = queryCursor.copyWith( startAt: [ ...queryCursor.startAt, - _$NestedPerFieldToJson.enumValue(startAt as TestEnum) + _$NestedPerFieldToJson.enumValue(startAt as TestEnum), ], startAtDocumentSnapshot: null, ); @@ -4973,7 +5177,7 @@ class _$NestedQuery extends QueryReference queryCursor = queryCursor.copyWith( startAfter: [ ...queryCursor.startAfter, - _$NestedPerFieldToJson.enumValue(startAfter as TestEnum) + _$NestedPerFieldToJson.enumValue(startAfter as TestEnum), ], startAfterDocumentSnapshot: null, ); @@ -4982,7 +5186,7 @@ class _$NestedQuery extends QueryReference queryCursor = queryCursor.copyWith( endAt: [ ...queryCursor.endAt, - _$NestedPerFieldToJson.enumValue(endAt as TestEnum) + _$NestedPerFieldToJson.enumValue(endAt as TestEnum), ], endAtDocumentSnapshot: null, ); @@ -4991,7 +5195,7 @@ class _$NestedQuery extends QueryReference queryCursor = queryCursor.copyWith( endBefore: [ ...queryCursor.endBefore, - _$NestedPerFieldToJson.enumValue(endBefore as TestEnum) + _$NestedPerFieldToJson.enumValue(endBefore as TestEnum), ], endBeforeDocumentSnapshot: null, ); @@ -5017,8 +5221,9 @@ class _$NestedQuery extends QueryReference NestedDocumentSnapshot? startAfterDocument, }) { final query = $referenceWithoutCursor.orderBy( - _$NestedFieldMap['nullableEnumValue']!, - descending: descending); + _$NestedFieldMap['nullableEnumValue']!, + descending: descending, + ); var queryCursor = $queryCursor; if (startAtDocument != null) { @@ -5050,7 +5255,7 @@ class _$NestedQuery extends QueryReference queryCursor = queryCursor.copyWith( startAt: [ ...queryCursor.startAt, - _$NestedPerFieldToJson.nullableEnumValue(startAt as TestEnum?) + _$NestedPerFieldToJson.nullableEnumValue(startAt as TestEnum?), ], startAtDocumentSnapshot: null, ); @@ -5059,7 +5264,7 @@ class _$NestedQuery extends QueryReference queryCursor = queryCursor.copyWith( startAfter: [ ...queryCursor.startAfter, - _$NestedPerFieldToJson.nullableEnumValue(startAfter as TestEnum?) + _$NestedPerFieldToJson.nullableEnumValue(startAfter as TestEnum?), ], startAfterDocumentSnapshot: null, ); @@ -5068,7 +5273,7 @@ class _$NestedQuery extends QueryReference queryCursor = queryCursor.copyWith( endAt: [ ...queryCursor.endAt, - _$NestedPerFieldToJson.nullableEnumValue(endAt as TestEnum?) + _$NestedPerFieldToJson.nullableEnumValue(endAt as TestEnum?), ], endAtDocumentSnapshot: null, ); @@ -5077,7 +5282,7 @@ class _$NestedQuery extends QueryReference queryCursor = queryCursor.copyWith( endBefore: [ ...queryCursor.endBefore, - _$NestedPerFieldToJson.nullableEnumValue(endBefore as TestEnum?) + _$NestedPerFieldToJson.nullableEnumValue(endBefore as TestEnum?), ], endBeforeDocumentSnapshot: null, ); @@ -5102,8 +5307,10 @@ class _$NestedQuery extends QueryReference NestedDocumentSnapshot? endBeforeDocument, NestedDocumentSnapshot? startAfterDocument, }) { - final query = $referenceWithoutCursor.orderBy(_$NestedFieldMap['enumList']!, - descending: descending); + final query = $referenceWithoutCursor.orderBy( + _$NestedFieldMap['enumList']!, + descending: descending, + ); var queryCursor = $queryCursor; if (startAtDocument != null) { @@ -5135,7 +5342,7 @@ class _$NestedQuery extends QueryReference queryCursor = queryCursor.copyWith( startAt: [ ...queryCursor.startAt, - _$NestedPerFieldToJson.enumList(startAt as List) + _$NestedPerFieldToJson.enumList(startAt as List), ], startAtDocumentSnapshot: null, ); @@ -5144,7 +5351,7 @@ class _$NestedQuery extends QueryReference queryCursor = queryCursor.copyWith( startAfter: [ ...queryCursor.startAfter, - _$NestedPerFieldToJson.enumList(startAfter as List) + _$NestedPerFieldToJson.enumList(startAfter as List), ], startAfterDocumentSnapshot: null, ); @@ -5153,7 +5360,7 @@ class _$NestedQuery extends QueryReference queryCursor = queryCursor.copyWith( endAt: [ ...queryCursor.endAt, - _$NestedPerFieldToJson.enumList(endAt as List) + _$NestedPerFieldToJson.enumList(endAt as List), ], endAtDocumentSnapshot: null, ); @@ -5162,7 +5369,7 @@ class _$NestedQuery extends QueryReference queryCursor = queryCursor.copyWith( endBefore: [ ...queryCursor.endBefore, - _$NestedPerFieldToJson.enumList(endBefore as List) + _$NestedPerFieldToJson.enumList(endBefore as List), ], endBeforeDocumentSnapshot: null, ); @@ -5187,8 +5394,10 @@ class _$NestedQuery extends QueryReference NestedDocumentSnapshot? endBeforeDocument, NestedDocumentSnapshot? startAfterDocument, }) { - final query = $referenceWithoutCursor - .orderBy(_$NestedFieldMap['nullableEnumList']!, descending: descending); + final query = $referenceWithoutCursor.orderBy( + _$NestedFieldMap['nullableEnumList']!, + descending: descending, + ); var queryCursor = $queryCursor; if (startAtDocument != null) { @@ -5220,7 +5429,7 @@ class _$NestedQuery extends QueryReference queryCursor = queryCursor.copyWith( startAt: [ ...queryCursor.startAt, - _$NestedPerFieldToJson.nullableEnumList(startAt as List?) + _$NestedPerFieldToJson.nullableEnumList(startAt as List?), ], startAtDocumentSnapshot: null, ); @@ -5229,7 +5438,9 @@ class _$NestedQuery extends QueryReference queryCursor = queryCursor.copyWith( startAfter: [ ...queryCursor.startAfter, - _$NestedPerFieldToJson.nullableEnumList(startAfter as List?) + _$NestedPerFieldToJson.nullableEnumList( + startAfter as List?, + ), ], startAfterDocumentSnapshot: null, ); @@ -5238,7 +5449,7 @@ class _$NestedQuery extends QueryReference queryCursor = queryCursor.copyWith( endAt: [ ...queryCursor.endAt, - _$NestedPerFieldToJson.nullableEnumList(endAt as List?) + _$NestedPerFieldToJson.nullableEnumList(endAt as List?), ], endAtDocumentSnapshot: null, ); @@ -5247,7 +5458,7 @@ class _$NestedQuery extends QueryReference queryCursor = queryCursor.copyWith( endBefore: [ ...queryCursor.endBefore, - _$NestedPerFieldToJson.nullableEnumList(endBefore as List?) + _$NestedPerFieldToJson.nullableEnumList(endBefore as List?), ], endBeforeDocumentSnapshot: null, ); @@ -5279,9 +5490,7 @@ class NestedDocumentSnapshot extends FirestoreDocumentSnapshot { @override NestedDocumentReference get reference { - return NestedDocumentReference( - snapshot.reference, - ); + return NestedDocumentReference(snapshot.reference); } @override @@ -5290,11 +5499,7 @@ class NestedDocumentSnapshot extends FirestoreDocumentSnapshot { class NestedQuerySnapshot extends FirestoreQuerySnapshot { - NestedQuerySnapshot._( - this.snapshot, - this.docs, - this.docChanges, - ); + NestedQuerySnapshot._(this.snapshot, this.docs, this.docChanges); factory NestedQuerySnapshot._fromQuerySnapshot( QuerySnapshot snapshot, @@ -5302,21 +5507,14 @@ class NestedQuerySnapshot final docs = snapshot.docs.map(NestedQueryDocumentSnapshot._).toList(); final docChanges = snapshot.docChanges.map((change) { - return _decodeDocumentChange( - change, - NestedDocumentSnapshot._, - ); + return _decodeDocumentChange(change, NestedDocumentSnapshot._); }).toList(); - return NestedQuerySnapshot._( - snapshot, - docs, - docChanges, - ); + return NestedQuerySnapshot._(snapshot, docs, docChanges); } static FirestoreDocumentChange - _decodeDocumentChange( + _decodeDocumentChange( DocumentChange docChange, NestedDocumentSnapshot Function(DocumentSnapshot doc) decodeDoc, ) { @@ -5360,9 +5558,8 @@ abstract class EmptyModelCollectionReference implements EmptyModelQuery, FirestoreCollectionReference { - factory EmptyModelCollectionReference([ - FirebaseFirestore? firestore, - ]) = _$EmptyModelCollectionReference; + factory EmptyModelCollectionReference([FirebaseFirestore? firestore]) = + _$EmptyModelCollectionReference; static EmptyModel fromFirestore( DocumentSnapshot> snapshot, @@ -5395,16 +5592,17 @@ class _$EmptyModelCollectionReference extends _$EmptyModelQuery firestore ??= FirebaseFirestore.instance; return _$EmptyModelCollectionReference._( - firestore.collection('config').withConverter( + firestore + .collection('config') + .withConverter( fromFirestore: EmptyModelCollectionReference.fromFirestore, toFirestore: EmptyModelCollectionReference.toFirestore, ), ); } - _$EmptyModelCollectionReference._( - CollectionReference reference, - ) : super(reference, $referenceWithoutCursor: reference); + _$EmptyModelCollectionReference._(CollectionReference reference) + : super(reference, $referenceWithoutCursor: reference); String get path => reference.path; @@ -5418,9 +5616,7 @@ class _$EmptyModelCollectionReference extends _$EmptyModelQuery id == null || id.split('/').length == 1, 'The document ID cannot be from a different collection', ); - return EmptyModelDocumentReference( - reference.doc(id), - ); + return EmptyModelDocumentReference(reference.doc(id)); } @override @@ -5607,17 +5803,17 @@ class _$EmptyModelQuery required Query $referenceWithoutCursor, $QueryCursor $queryCursor = const $QueryCursor(), }) : super( - $referenceWithoutCursor: $referenceWithoutCursor, - $queryCursor: $queryCursor, - ); + $referenceWithoutCursor: $referenceWithoutCursor, + $queryCursor: $queryCursor, + ); final CollectionReference _collection; @override Stream snapshots([SnapshotOptions? options]) { - return reference - .snapshots() - .map(EmptyModelQuerySnapshot._fromQuerySnapshot); + return reference.snapshots().map( + EmptyModelQuerySnapshot._fromQuerySnapshot, + ); } @override @@ -5674,7 +5870,8 @@ class _$EmptyModelQuery arrayContainsAny: arrayContainsAny, whereIn: whereIn, whereNotIn: whereNotIn, - isNull: isNull ?? + isNull: + isNull ?? (isEqualTo == null ? false : null) ?? (isNotEqualTo == null ? true : null), ), @@ -5706,7 +5903,8 @@ class _$EmptyModelQuery isGreaterThanOrEqualTo: isGreaterThanOrEqualTo, whereIn: whereIn, whereNotIn: whereNotIn, - isNull: isNull ?? + isNull: + isNull ?? (isEqualTo == null ? false : null) ?? (isNotEqualTo == null ? true : null), ), @@ -5727,8 +5925,10 @@ class _$EmptyModelQuery EmptyModelDocumentSnapshot? endBeforeDocument, EmptyModelDocumentSnapshot? startAfterDocument, }) { - final query = - $referenceWithoutCursor.orderBy(fieldPath, descending: descending); + final query = $referenceWithoutCursor.orderBy( + fieldPath, + descending: descending, + ); var queryCursor = $queryCursor; if (startAtDocument != null) { @@ -5800,8 +6000,10 @@ class _$EmptyModelQuery EmptyModelDocumentSnapshot? endBeforeDocument, EmptyModelDocumentSnapshot? startAfterDocument, }) { - final query = $referenceWithoutCursor.orderBy(FieldPath.documentId, - descending: descending); + final query = $referenceWithoutCursor.orderBy( + FieldPath.documentId, + descending: descending, + ); var queryCursor = $queryCursor; if (startAtDocument != null) { @@ -5880,22 +6082,17 @@ class EmptyModelDocumentSnapshot extends FirestoreDocumentSnapshot { @override EmptyModelDocumentReference get reference { - return EmptyModelDocumentReference( - snapshot.reference, - ); + return EmptyModelDocumentReference(snapshot.reference); } @override final EmptyModel? data; } -class EmptyModelQuerySnapshot extends FirestoreQuerySnapshot { - EmptyModelQuerySnapshot._( - this.snapshot, - this.docs, - this.docChanges, - ); +class EmptyModelQuerySnapshot + extends + FirestoreQuerySnapshot { + EmptyModelQuerySnapshot._(this.snapshot, this.docs, this.docChanges); factory EmptyModelQuerySnapshot._fromQuerySnapshot( QuerySnapshot snapshot, @@ -5903,21 +6100,14 @@ class EmptyModelQuerySnapshot extends FirestoreQuerySnapshot - _decodeDocumentChange( + _decodeDocumentChange( DocumentChange docChange, EmptyModelDocumentSnapshot Function(DocumentSnapshot doc) decodeDoc, ) { @@ -5962,9 +6152,8 @@ abstract class OptionalJsonCollectionReference implements OptionalJsonQuery, FirestoreCollectionReference { - factory OptionalJsonCollectionReference([ - FirebaseFirestore? firestore, - ]) = _$OptionalJsonCollectionReference; + factory OptionalJsonCollectionReference([FirebaseFirestore? firestore]) = + _$OptionalJsonCollectionReference; static OptionalJson fromFirestore( DocumentSnapshot> snapshot, @@ -5997,7 +6186,9 @@ class _$OptionalJsonCollectionReference extends _$OptionalJsonQuery firestore ??= FirebaseFirestore.instance; return _$OptionalJsonCollectionReference._( - firestore.collection('root').withConverter( + firestore + .collection('root') + .withConverter( fromFirestore: OptionalJsonCollectionReference.fromFirestore, toFirestore: OptionalJsonCollectionReference.toFirestore, ), @@ -6020,9 +6211,7 @@ class _$OptionalJsonCollectionReference extends _$OptionalJsonQuery id == null || id.split('/').length == 1, 'The document ID cannot be from a different collection', ); - return OptionalJsonDocumentReference( - reference.doc(id), - ); + return OptionalJsonDocumentReference(reference.doc(id)); } @override @@ -6043,11 +6232,12 @@ class _$OptionalJsonCollectionReference extends _$OptionalJsonQuery int get hashCode => Object.hash(runtimeType, reference); } -abstract class OptionalJsonDocumentReference extends FirestoreDocumentReference< - OptionalJson, OptionalJsonDocumentSnapshot> { +abstract class OptionalJsonDocumentReference + extends + FirestoreDocumentReference { factory OptionalJsonDocumentReference( - DocumentReference reference) = - _$OptionalJsonDocumentReference; + DocumentReference reference, + ) = _$OptionalJsonDocumentReference; DocumentReference get reference; @@ -6111,10 +6301,7 @@ abstract class OptionalJsonDocumentReference extends FirestoreDocumentReference< /// document data. /// /// If no document exists yet, the update will fail. - Future update({ - int value, - FieldValue valueFieldValue, - }); + Future update({int value, FieldValue valueFieldValue}); /// Updates fields in the current document using the transaction API. /// @@ -6128,16 +6315,13 @@ abstract class OptionalJsonDocumentReference extends FirestoreDocumentReference< /// Updates fields in the current document using the batch API. /// /// The update will fail if applied to a document that does not exist. - void batchUpdate( - WriteBatch batch, { - int value, - FieldValue valueFieldValue, - }); + void batchUpdate(WriteBatch batch, {int value, FieldValue valueFieldValue}); } -class _$OptionalJsonDocumentReference extends FirestoreDocumentReference< - OptionalJson, - OptionalJsonDocumentSnapshot> implements OptionalJsonDocumentReference { +class _$OptionalJsonDocumentReference + extends + FirestoreDocumentReference + implements OptionalJsonDocumentReference { _$OptionalJsonDocumentReference(this.reference); @override @@ -6229,8 +6413,10 @@ class _$OptionalJsonDocumentReference extends FirestoreDocumentReference< ); final json = { if (value != _sentinel) - _$OptionalJsonFieldMap['value']!: - _$OptionalJsonPerFieldToJson.value(value as int), + _$OptionalJsonFieldMap['value']!: _$OptionalJsonPerFieldToJson.value( + value as int, + ), + if (valueFieldValue != null) _$OptionalJsonFieldMap['value']!: valueFieldValue, }; @@ -6249,8 +6435,10 @@ class _$OptionalJsonDocumentReference extends FirestoreDocumentReference< ); final json = { if (value != _sentinel) - _$OptionalJsonFieldMap['value']!: - _$OptionalJsonPerFieldToJson.value(value as int), + _$OptionalJsonFieldMap['value']!: _$OptionalJsonPerFieldToJson.value( + value as int, + ), + if (valueFieldValue != null) _$OptionalJsonFieldMap['value']!: valueFieldValue, }; @@ -6269,8 +6457,10 @@ class _$OptionalJsonDocumentReference extends FirestoreDocumentReference< ); final json = { if (value != _sentinel) - _$OptionalJsonFieldMap['value']!: - _$OptionalJsonPerFieldToJson.value(value as int), + _$OptionalJsonFieldMap['value']!: _$OptionalJsonPerFieldToJson.value( + value as int, + ), + if (valueFieldValue != null) _$OptionalJsonFieldMap['value']!: valueFieldValue, }; @@ -6420,17 +6610,17 @@ class _$OptionalJsonQuery required Query $referenceWithoutCursor, $QueryCursor $queryCursor = const $QueryCursor(), }) : super( - $referenceWithoutCursor: $referenceWithoutCursor, - $queryCursor: $queryCursor, - ); + $referenceWithoutCursor: $referenceWithoutCursor, + $queryCursor: $queryCursor, + ); final CollectionReference _collection; @override Stream snapshots([SnapshotOptions? options]) { - return reference - .snapshots() - .map(OptionalJsonQuerySnapshot._fromQuerySnapshot); + return reference.snapshots().map( + OptionalJsonQuerySnapshot._fromQuerySnapshot, + ); } @override @@ -6487,7 +6677,8 @@ class _$OptionalJsonQuery arrayContainsAny: arrayContainsAny, whereIn: whereIn, whereNotIn: whereNotIn, - isNull: isNull ?? + isNull: + isNull ?? (isEqualTo == null ? false : null) ?? (isNotEqualTo == null ? true : null), ), @@ -6519,7 +6710,8 @@ class _$OptionalJsonQuery isGreaterThanOrEqualTo: isGreaterThanOrEqualTo, whereIn: whereIn, whereNotIn: whereNotIn, - isNull: isNull ?? + isNull: + isNull ?? (isEqualTo == null ? false : null) ?? (isNotEqualTo == null ? true : null), ), @@ -6562,9 +6754,11 @@ class _$OptionalJsonQuery ? _$OptionalJsonPerFieldToJson.value(isGreaterThanOrEqualTo as int) : null, whereIn: whereIn?.map((e) => _$OptionalJsonPerFieldToJson.value(e)), - whereNotIn: - whereNotIn?.map((e) => _$OptionalJsonPerFieldToJson.value(e)), - isNull: isNull ?? + whereNotIn: whereNotIn?.map( + (e) => _$OptionalJsonPerFieldToJson.value(e), + ), + isNull: + isNull ?? (isEqualTo == null ? false : null) ?? (isNotEqualTo == null ? true : null), ), @@ -6585,8 +6779,10 @@ class _$OptionalJsonQuery OptionalJsonDocumentSnapshot? endBeforeDocument, OptionalJsonDocumentSnapshot? startAfterDocument, }) { - final query = - $referenceWithoutCursor.orderBy(fieldPath, descending: descending); + final query = $referenceWithoutCursor.orderBy( + fieldPath, + descending: descending, + ); var queryCursor = $queryCursor; if (startAtDocument != null) { @@ -6658,8 +6854,10 @@ class _$OptionalJsonQuery OptionalJsonDocumentSnapshot? endBeforeDocument, OptionalJsonDocumentSnapshot? startAfterDocument, }) { - final query = $referenceWithoutCursor.orderBy(FieldPath.documentId, - descending: descending); + final query = $referenceWithoutCursor.orderBy( + FieldPath.documentId, + descending: descending, + ); var queryCursor = $queryCursor; if (startAtDocument != null) { @@ -6731,8 +6929,10 @@ class _$OptionalJsonQuery OptionalJsonDocumentSnapshot? endBeforeDocument, OptionalJsonDocumentSnapshot? startAfterDocument, }) { - final query = $referenceWithoutCursor - .orderBy(_$OptionalJsonFieldMap['value']!, descending: descending); + final query = $referenceWithoutCursor.orderBy( + _$OptionalJsonFieldMap['value']!, + descending: descending, + ); var queryCursor = $queryCursor; if (startAtDocument != null) { @@ -6764,7 +6964,7 @@ class _$OptionalJsonQuery queryCursor = queryCursor.copyWith( startAt: [ ...queryCursor.startAt, - _$OptionalJsonPerFieldToJson.value(startAt as int) + _$OptionalJsonPerFieldToJson.value(startAt as int), ], startAtDocumentSnapshot: null, ); @@ -6773,7 +6973,7 @@ class _$OptionalJsonQuery queryCursor = queryCursor.copyWith( startAfter: [ ...queryCursor.startAfter, - _$OptionalJsonPerFieldToJson.value(startAfter as int) + _$OptionalJsonPerFieldToJson.value(startAfter as int), ], startAfterDocumentSnapshot: null, ); @@ -6782,7 +6982,7 @@ class _$OptionalJsonQuery queryCursor = queryCursor.copyWith( endAt: [ ...queryCursor.endAt, - _$OptionalJsonPerFieldToJson.value(endAt as int) + _$OptionalJsonPerFieldToJson.value(endAt as int), ], endAtDocumentSnapshot: null, ); @@ -6791,7 +6991,7 @@ class _$OptionalJsonQuery queryCursor = queryCursor.copyWith( endBefore: [ ...queryCursor.endBefore, - _$OptionalJsonPerFieldToJson.value(endBefore as int) + _$OptionalJsonPerFieldToJson.value(endBefore as int), ], endBeforeDocumentSnapshot: null, ); @@ -6824,45 +7024,37 @@ class OptionalJsonDocumentSnapshot @override OptionalJsonDocumentReference get reference { - return OptionalJsonDocumentReference( - snapshot.reference, - ); + return OptionalJsonDocumentReference(snapshot.reference); } @override final OptionalJson? data; } -class OptionalJsonQuerySnapshot extends FirestoreQuerySnapshot { - OptionalJsonQuerySnapshot._( - this.snapshot, - this.docs, - this.docChanges, - ); +class OptionalJsonQuerySnapshot + extends + FirestoreQuerySnapshot< + OptionalJson, + OptionalJsonQueryDocumentSnapshot + > { + OptionalJsonQuerySnapshot._(this.snapshot, this.docs, this.docChanges); factory OptionalJsonQuerySnapshot._fromQuerySnapshot( QuerySnapshot snapshot, ) { - final docs = - snapshot.docs.map(OptionalJsonQueryDocumentSnapshot._).toList(); + final docs = snapshot.docs + .map(OptionalJsonQueryDocumentSnapshot._) + .toList(); final docChanges = snapshot.docChanges.map((change) { - return _decodeDocumentChange( - change, - OptionalJsonDocumentSnapshot._, - ); + return _decodeDocumentChange(change, OptionalJsonDocumentSnapshot._); }).toList(); - return OptionalJsonQuerySnapshot._( - snapshot, - docs, - docChanges, - ); + return OptionalJsonQuerySnapshot._(snapshot, docs, docChanges); } static FirestoreDocumentChange - _decodeDocumentChange( + _decodeDocumentChange( DocumentChange docChange, OptionalJsonDocumentSnapshot Function(DocumentSnapshot doc) decodeDoc, ) { @@ -6907,9 +7099,8 @@ abstract class MixedJsonCollectionReference implements MixedJsonQuery, FirestoreCollectionReference { - factory MixedJsonCollectionReference([ - FirebaseFirestore? firestore, - ]) = _$MixedJsonCollectionReference; + factory MixedJsonCollectionReference([FirebaseFirestore? firestore]) = + _$MixedJsonCollectionReference; static MixedJson fromFirestore( DocumentSnapshot> snapshot, @@ -6942,16 +7133,17 @@ class _$MixedJsonCollectionReference extends _$MixedJsonQuery firestore ??= FirebaseFirestore.instance; return _$MixedJsonCollectionReference._( - firestore.collection('root').withConverter( + firestore + .collection('root') + .withConverter( fromFirestore: MixedJsonCollectionReference.fromFirestore, toFirestore: MixedJsonCollectionReference.toFirestore, ), ); } - _$MixedJsonCollectionReference._( - CollectionReference reference, - ) : super(reference, $referenceWithoutCursor: reference); + _$MixedJsonCollectionReference._(CollectionReference reference) + : super(reference, $referenceWithoutCursor: reference); String get path => reference.path; @@ -6965,9 +7157,7 @@ class _$MixedJsonCollectionReference extends _$MixedJsonQuery id == null || id.split('/').length == 1, 'The document ID cannot be from a different collection', ); - return MixedJsonDocumentReference( - reference.doc(id), - ); + return MixedJsonDocumentReference(reference.doc(id)); } @override @@ -7053,10 +7243,7 @@ abstract class MixedJsonDocumentReference /// document data. /// /// If no document exists yet, the update will fail. - Future update({ - int value, - FieldValue valueFieldValue, - }); + Future update({int value, FieldValue valueFieldValue}); /// Updates fields in the current document using the transaction API. /// @@ -7070,11 +7257,7 @@ abstract class MixedJsonDocumentReference /// Updates fields in the current document using the batch API. /// /// The update will fail if applied to a document that does not exist. - void batchUpdate( - WriteBatch batch, { - int value, - FieldValue valueFieldValue, - }); + void batchUpdate(WriteBatch batch, {int value, FieldValue valueFieldValue}); } class _$MixedJsonDocumentReference @@ -7171,8 +7354,10 @@ class _$MixedJsonDocumentReference ); final json = { if (value != _sentinel) - _$MixedJsonFieldMap['value']!: - _$MixedJsonPerFieldToJson.value(value as int), + _$MixedJsonFieldMap['value']!: _$MixedJsonPerFieldToJson.value( + value as int, + ), + if (valueFieldValue != null) _$MixedJsonFieldMap['value']!: valueFieldValue, }; @@ -7191,8 +7376,10 @@ class _$MixedJsonDocumentReference ); final json = { if (value != _sentinel) - _$MixedJsonFieldMap['value']!: - _$MixedJsonPerFieldToJson.value(value as int), + _$MixedJsonFieldMap['value']!: _$MixedJsonPerFieldToJson.value( + value as int, + ), + if (valueFieldValue != null) _$MixedJsonFieldMap['value']!: valueFieldValue, }; @@ -7211,8 +7398,10 @@ class _$MixedJsonDocumentReference ); final json = { if (value != _sentinel) - _$MixedJsonFieldMap['value']!: - _$MixedJsonPerFieldToJson.value(value as int), + _$MixedJsonFieldMap['value']!: _$MixedJsonPerFieldToJson.value( + value as int, + ), + if (valueFieldValue != null) _$MixedJsonFieldMap['value']!: valueFieldValue, }; @@ -7361,9 +7550,9 @@ class _$MixedJsonQuery extends QueryReference required Query $referenceWithoutCursor, $QueryCursor $queryCursor = const $QueryCursor(), }) : super( - $referenceWithoutCursor: $referenceWithoutCursor, - $queryCursor: $queryCursor, - ); + $referenceWithoutCursor: $referenceWithoutCursor, + $queryCursor: $queryCursor, + ); final CollectionReference _collection; @@ -7426,7 +7615,8 @@ class _$MixedJsonQuery extends QueryReference arrayContainsAny: arrayContainsAny, whereIn: whereIn, whereNotIn: whereNotIn, - isNull: isNull ?? + isNull: + isNull ?? (isEqualTo == null ? false : null) ?? (isNotEqualTo == null ? true : null), ), @@ -7458,7 +7648,8 @@ class _$MixedJsonQuery extends QueryReference isGreaterThanOrEqualTo: isGreaterThanOrEqualTo, whereIn: whereIn, whereNotIn: whereNotIn, - isNull: isNull ?? + isNull: + isNull ?? (isEqualTo == null ? false : null) ?? (isNotEqualTo == null ? true : null), ), @@ -7502,7 +7693,8 @@ class _$MixedJsonQuery extends QueryReference : null, whereIn: whereIn?.map((e) => _$MixedJsonPerFieldToJson.value(e)), whereNotIn: whereNotIn?.map((e) => _$MixedJsonPerFieldToJson.value(e)), - isNull: isNull ?? + isNull: + isNull ?? (isEqualTo == null ? false : null) ?? (isNotEqualTo == null ? true : null), ), @@ -7523,8 +7715,10 @@ class _$MixedJsonQuery extends QueryReference MixedJsonDocumentSnapshot? endBeforeDocument, MixedJsonDocumentSnapshot? startAfterDocument, }) { - final query = - $referenceWithoutCursor.orderBy(fieldPath, descending: descending); + final query = $referenceWithoutCursor.orderBy( + fieldPath, + descending: descending, + ); var queryCursor = $queryCursor; if (startAtDocument != null) { @@ -7596,8 +7790,10 @@ class _$MixedJsonQuery extends QueryReference MixedJsonDocumentSnapshot? endBeforeDocument, MixedJsonDocumentSnapshot? startAfterDocument, }) { - final query = $referenceWithoutCursor.orderBy(FieldPath.documentId, - descending: descending); + final query = $referenceWithoutCursor.orderBy( + FieldPath.documentId, + descending: descending, + ); var queryCursor = $queryCursor; if (startAtDocument != null) { @@ -7669,8 +7865,10 @@ class _$MixedJsonQuery extends QueryReference MixedJsonDocumentSnapshot? endBeforeDocument, MixedJsonDocumentSnapshot? startAfterDocument, }) { - final query = $referenceWithoutCursor.orderBy(_$MixedJsonFieldMap['value']!, - descending: descending); + final query = $referenceWithoutCursor.orderBy( + _$MixedJsonFieldMap['value']!, + descending: descending, + ); var queryCursor = $queryCursor; if (startAtDocument != null) { @@ -7702,7 +7900,7 @@ class _$MixedJsonQuery extends QueryReference queryCursor = queryCursor.copyWith( startAt: [ ...queryCursor.startAt, - _$MixedJsonPerFieldToJson.value(startAt as int) + _$MixedJsonPerFieldToJson.value(startAt as int), ], startAtDocumentSnapshot: null, ); @@ -7711,7 +7909,7 @@ class _$MixedJsonQuery extends QueryReference queryCursor = queryCursor.copyWith( startAfter: [ ...queryCursor.startAfter, - _$MixedJsonPerFieldToJson.value(startAfter as int) + _$MixedJsonPerFieldToJson.value(startAfter as int), ], startAfterDocumentSnapshot: null, ); @@ -7720,7 +7918,7 @@ class _$MixedJsonQuery extends QueryReference queryCursor = queryCursor.copyWith( endAt: [ ...queryCursor.endAt, - _$MixedJsonPerFieldToJson.value(endAt as int) + _$MixedJsonPerFieldToJson.value(endAt as int), ], endAtDocumentSnapshot: null, ); @@ -7729,7 +7927,7 @@ class _$MixedJsonQuery extends QueryReference queryCursor = queryCursor.copyWith( endBefore: [ ...queryCursor.endBefore, - _$MixedJsonPerFieldToJson.value(endBefore as int) + _$MixedJsonPerFieldToJson.value(endBefore as int), ], endBeforeDocumentSnapshot: null, ); @@ -7761,9 +7959,7 @@ class MixedJsonDocumentSnapshot extends FirestoreDocumentSnapshot { @override MixedJsonDocumentReference get reference { - return MixedJsonDocumentReference( - snapshot.reference, - ); + return MixedJsonDocumentReference(snapshot.reference); } @override @@ -7772,11 +7968,7 @@ class MixedJsonDocumentSnapshot extends FirestoreDocumentSnapshot { class MixedJsonQuerySnapshot extends FirestoreQuerySnapshot { - MixedJsonQuerySnapshot._( - this.snapshot, - this.docs, - this.docChanges, - ); + MixedJsonQuerySnapshot._(this.snapshot, this.docs, this.docChanges); factory MixedJsonQuerySnapshot._fromQuerySnapshot( QuerySnapshot snapshot, @@ -7784,21 +7976,14 @@ class MixedJsonQuerySnapshot final docs = snapshot.docs.map(MixedJsonQueryDocumentSnapshot._).toList(); final docChanges = snapshot.docChanges.map((change) { - return _decodeDocumentChange( - change, - MixedJsonDocumentSnapshot._, - ); + return _decodeDocumentChange(change, MixedJsonDocumentSnapshot._); }).toList(); - return MixedJsonQuerySnapshot._( - snapshot, - docs, - docChanges, - ); + return MixedJsonQuerySnapshot._(snapshot, docs, docChanges); } static FirestoreDocumentChange - _decodeDocumentChange( + _decodeDocumentChange( DocumentChange docChange, MixedJsonDocumentSnapshot Function(DocumentSnapshot doc) decodeDoc, ) { @@ -7843,9 +8028,8 @@ abstract class RootCollectionReference implements RootQuery, FirestoreCollectionReference { - factory RootCollectionReference([ - FirebaseFirestore? firestore, - ]) = _$RootCollectionReference; + factory RootCollectionReference([FirebaseFirestore? firestore]) = + _$RootCollectionReference; static Root fromFirestore( DocumentSnapshot> snapshot, @@ -7854,10 +8038,7 @@ abstract class RootCollectionReference return Root.fromJson(snapshot.data()!); } - static Map toFirestore( - Root value, - SetOptions? options, - ) { + static Map toFirestore(Root value, SetOptions? options) { return value.toJson(); } @@ -7878,16 +8059,17 @@ class _$RootCollectionReference extends _$RootQuery firestore ??= FirebaseFirestore.instance; return _$RootCollectionReference._( - firestore.collection('root').withConverter( + firestore + .collection('root') + .withConverter( fromFirestore: RootCollectionReference.fromFirestore, toFirestore: RootCollectionReference.toFirestore, ), ); } - _$RootCollectionReference._( - CollectionReference reference, - ) : super(reference, $referenceWithoutCursor: reference); + _$RootCollectionReference._(CollectionReference reference) + : super(reference, $referenceWithoutCursor: reference); String get path => reference.path; @@ -7901,9 +8083,7 @@ class _$RootCollectionReference extends _$RootQuery id == null || id.split('/').length == 1, 'The document ID cannot be from a different collection', ); - return RootDocumentReference( - reference.doc(id), - ); + return RootDocumentReference(reference.doc(id)); } @override @@ -7934,24 +8114,16 @@ abstract class RootDocumentReference return _$RootCollectionReference(reference.firestore); } - late final SubCollectionReference sub = _$SubCollectionReference( - reference, - ); + late final SubCollectionReference sub = _$SubCollectionReference(reference); late final AsCamelCaseCollectionReference asCamelCase = - _$AsCamelCaseCollectionReference( - reference, - ); + _$AsCamelCaseCollectionReference(reference); late final CustomSubNameCollectionReference thisIsACustomName = - _$CustomSubNameCollectionReference( - reference, - ); + _$CustomSubNameCollectionReference(reference); late final ThisIsACustomPrefixCollectionReference customClassPrefix = - _$ThisIsACustomPrefixCollectionReference( - reference, - ); + _$ThisIsACustomPrefixCollectionReference(reference); @override Stream snapshots(); @@ -8054,24 +8226,16 @@ class _$RootDocumentReference return _$RootCollectionReference(reference.firestore); } - late final SubCollectionReference sub = _$SubCollectionReference( - reference, - ); + late final SubCollectionReference sub = _$SubCollectionReference(reference); late final AsCamelCaseCollectionReference asCamelCase = - _$AsCamelCaseCollectionReference( - reference, - ); + _$AsCamelCaseCollectionReference(reference); late final CustomSubNameCollectionReference thisIsACustomName = - _$CustomSubNameCollectionReference( - reference, - ); + _$CustomSubNameCollectionReference(reference); late final ThisIsACustomPrefixCollectionReference customClassPrefix = - _$ThisIsACustomPrefixCollectionReference( - reference, - ); + _$ThisIsACustomPrefixCollectionReference(reference); @override Stream snapshots() { @@ -8098,6 +8262,7 @@ class _$RootDocumentReference ...model.toJson(), if (nonNullableFieldValue != null) _$RootFieldMap['nonNullable']!: nonNullableFieldValue, + if (nullableFieldValue != null) _$RootFieldMap['nullable']!: nullableFieldValue, }; @@ -8120,6 +8285,7 @@ class _$RootDocumentReference ...model.toJson(), if (nonNullableFieldValue != null) _$RootFieldMap['nonNullable']!: nonNullableFieldValue, + if (nullableFieldValue != null) _$RootFieldMap['nullable']!: nullableFieldValue, }; @@ -8142,6 +8308,7 @@ class _$RootDocumentReference ...model.toJson(), if (nonNullableFieldValue != null) _$RootFieldMap['nonNullable']!: nonNullableFieldValue, + if (nullableFieldValue != null) _$RootFieldMap['nullable']!: nullableFieldValue, }; @@ -8169,13 +8336,18 @@ class _$RootDocumentReference ); final json = { if (nonNullable != _sentinel) - _$RootFieldMap['nonNullable']!: - _$RootPerFieldToJson.nonNullable(nonNullable as String), + _$RootFieldMap['nonNullable']!: _$RootPerFieldToJson.nonNullable( + nonNullable as String, + ), + if (nonNullableFieldValue != null) _$RootFieldMap['nonNullable']!: nonNullableFieldValue, + if (nullable != _sentinel) - _$RootFieldMap['nullable']!: - _$RootPerFieldToJson.nullable(nullable as int?), + _$RootFieldMap['nullable']!: _$RootPerFieldToJson.nullable( + nullable as int?, + ), + if (nullableFieldValue != null) _$RootFieldMap['nullable']!: nullableFieldValue, }; @@ -8200,13 +8372,18 @@ class _$RootDocumentReference ); final json = { if (nonNullable != _sentinel) - _$RootFieldMap['nonNullable']!: - _$RootPerFieldToJson.nonNullable(nonNullable as String), + _$RootFieldMap['nonNullable']!: _$RootPerFieldToJson.nonNullable( + nonNullable as String, + ), + if (nonNullableFieldValue != null) _$RootFieldMap['nonNullable']!: nonNullableFieldValue, + if (nullable != _sentinel) - _$RootFieldMap['nullable']!: - _$RootPerFieldToJson.nullable(nullable as int?), + _$RootFieldMap['nullable']!: _$RootPerFieldToJson.nullable( + nullable as int?, + ), + if (nullableFieldValue != null) _$RootFieldMap['nullable']!: nullableFieldValue, }; @@ -8231,13 +8408,18 @@ class _$RootDocumentReference ); final json = { if (nonNullable != _sentinel) - _$RootFieldMap['nonNullable']!: - _$RootPerFieldToJson.nonNullable(nonNullable as String), + _$RootFieldMap['nonNullable']!: _$RootPerFieldToJson.nonNullable( + nonNullable as String, + ), + if (nonNullableFieldValue != null) _$RootFieldMap['nonNullable']!: nonNullableFieldValue, + if (nullable != _sentinel) - _$RootFieldMap['nullable']!: - _$RootPerFieldToJson.nullable(nullable as int?), + _$RootFieldMap['nullable']!: _$RootPerFieldToJson.nullable( + nullable as int?, + ), + if (nullableFieldValue != null) _$RootFieldMap['nullable']!: nullableFieldValue, }; @@ -8409,9 +8591,9 @@ class _$RootQuery extends QueryReference required Query $referenceWithoutCursor, $QueryCursor $queryCursor = const $QueryCursor(), }) : super( - $referenceWithoutCursor: $referenceWithoutCursor, - $queryCursor: $queryCursor, - ); + $referenceWithoutCursor: $referenceWithoutCursor, + $queryCursor: $queryCursor, + ); final CollectionReference _collection; @@ -8472,7 +8654,8 @@ class _$RootQuery extends QueryReference arrayContainsAny: arrayContainsAny, whereIn: whereIn, whereNotIn: whereNotIn, - isNull: isNull ?? + isNull: + isNull ?? (isEqualTo == null ? false : null) ?? (isNotEqualTo == null ? true : null), ), @@ -8504,7 +8687,8 @@ class _$RootQuery extends QueryReference isGreaterThanOrEqualTo: isGreaterThanOrEqualTo, whereIn: whereIn, whereNotIn: whereNotIn, - isNull: isNull ?? + isNull: + isNull ?? (isEqualTo == null ? false : null) ?? (isNotEqualTo == null ? true : null), ), @@ -8548,7 +8732,8 @@ class _$RootQuery extends QueryReference : null, whereIn: whereIn?.map((e) => _$RootPerFieldToJson.nonNullable(e)), whereNotIn: whereNotIn?.map((e) => _$RootPerFieldToJson.nonNullable(e)), - isNull: isNull ?? + isNull: + isNull ?? (isEqualTo == null ? false : null) ?? (isNotEqualTo == null ? true : null), ), @@ -8592,7 +8777,8 @@ class _$RootQuery extends QueryReference : null, whereIn: whereIn?.map((e) => _$RootPerFieldToJson.nullable(e)), whereNotIn: whereNotIn?.map((e) => _$RootPerFieldToJson.nullable(e)), - isNull: isNull ?? + isNull: + isNull ?? (isEqualTo == null ? false : null) ?? (isNotEqualTo == null ? true : null), ), @@ -8613,8 +8799,10 @@ class _$RootQuery extends QueryReference RootDocumentSnapshot? endBeforeDocument, RootDocumentSnapshot? startAfterDocument, }) { - final query = - $referenceWithoutCursor.orderBy(fieldPath, descending: descending); + final query = $referenceWithoutCursor.orderBy( + fieldPath, + descending: descending, + ); var queryCursor = $queryCursor; if (startAtDocument != null) { @@ -8686,8 +8874,10 @@ class _$RootQuery extends QueryReference RootDocumentSnapshot? endBeforeDocument, RootDocumentSnapshot? startAfterDocument, }) { - final query = $referenceWithoutCursor.orderBy(FieldPath.documentId, - descending: descending); + final query = $referenceWithoutCursor.orderBy( + FieldPath.documentId, + descending: descending, + ); var queryCursor = $queryCursor; if (startAtDocument != null) { @@ -8759,8 +8949,10 @@ class _$RootQuery extends QueryReference RootDocumentSnapshot? endBeforeDocument, RootDocumentSnapshot? startAfterDocument, }) { - final query = $referenceWithoutCursor - .orderBy(_$RootFieldMap['nonNullable']!, descending: descending); + final query = $referenceWithoutCursor.orderBy( + _$RootFieldMap['nonNullable']!, + descending: descending, + ); var queryCursor = $queryCursor; if (startAtDocument != null) { @@ -8792,7 +8984,7 @@ class _$RootQuery extends QueryReference queryCursor = queryCursor.copyWith( startAt: [ ...queryCursor.startAt, - _$RootPerFieldToJson.nonNullable(startAt as String) + _$RootPerFieldToJson.nonNullable(startAt as String), ], startAtDocumentSnapshot: null, ); @@ -8801,7 +8993,7 @@ class _$RootQuery extends QueryReference queryCursor = queryCursor.copyWith( startAfter: [ ...queryCursor.startAfter, - _$RootPerFieldToJson.nonNullable(startAfter as String) + _$RootPerFieldToJson.nonNullable(startAfter as String), ], startAfterDocumentSnapshot: null, ); @@ -8810,7 +9002,7 @@ class _$RootQuery extends QueryReference queryCursor = queryCursor.copyWith( endAt: [ ...queryCursor.endAt, - _$RootPerFieldToJson.nonNullable(endAt as String) + _$RootPerFieldToJson.nonNullable(endAt as String), ], endAtDocumentSnapshot: null, ); @@ -8819,7 +9011,7 @@ class _$RootQuery extends QueryReference queryCursor = queryCursor.copyWith( endBefore: [ ...queryCursor.endBefore, - _$RootPerFieldToJson.nonNullable(endBefore as String) + _$RootPerFieldToJson.nonNullable(endBefore as String), ], endBeforeDocumentSnapshot: null, ); @@ -8844,8 +9036,10 @@ class _$RootQuery extends QueryReference RootDocumentSnapshot? endBeforeDocument, RootDocumentSnapshot? startAfterDocument, }) { - final query = $referenceWithoutCursor.orderBy(_$RootFieldMap['nullable']!, - descending: descending); + final query = $referenceWithoutCursor.orderBy( + _$RootFieldMap['nullable']!, + descending: descending, + ); var queryCursor = $queryCursor; if (startAtDocument != null) { @@ -8877,7 +9071,7 @@ class _$RootQuery extends QueryReference queryCursor = queryCursor.copyWith( startAt: [ ...queryCursor.startAt, - _$RootPerFieldToJson.nullable(startAt as int?) + _$RootPerFieldToJson.nullable(startAt as int?), ], startAtDocumentSnapshot: null, ); @@ -8886,7 +9080,7 @@ class _$RootQuery extends QueryReference queryCursor = queryCursor.copyWith( startAfter: [ ...queryCursor.startAfter, - _$RootPerFieldToJson.nullable(startAfter as int?) + _$RootPerFieldToJson.nullable(startAfter as int?), ], startAfterDocumentSnapshot: null, ); @@ -8895,7 +9089,7 @@ class _$RootQuery extends QueryReference queryCursor = queryCursor.copyWith( endAt: [ ...queryCursor.endAt, - _$RootPerFieldToJson.nullable(endAt as int?) + _$RootPerFieldToJson.nullable(endAt as int?), ], endAtDocumentSnapshot: null, ); @@ -8904,7 +9098,7 @@ class _$RootQuery extends QueryReference queryCursor = queryCursor.copyWith( endBefore: [ ...queryCursor.endBefore, - _$RootPerFieldToJson.nullable(endBefore as int?) + _$RootPerFieldToJson.nullable(endBefore as int?), ], endBeforeDocumentSnapshot: null, ); @@ -8936,9 +9130,7 @@ class RootDocumentSnapshot extends FirestoreDocumentSnapshot { @override RootDocumentReference get reference { - return RootDocumentReference( - snapshot.reference, - ); + return RootDocumentReference(snapshot.reference); } @override @@ -8947,29 +9139,16 @@ class RootDocumentSnapshot extends FirestoreDocumentSnapshot { class RootQuerySnapshot extends FirestoreQuerySnapshot { - RootQuerySnapshot._( - this.snapshot, - this.docs, - this.docChanges, - ); - - factory RootQuerySnapshot._fromQuerySnapshot( - QuerySnapshot snapshot, - ) { + RootQuerySnapshot._(this.snapshot, this.docs, this.docChanges); + + factory RootQuerySnapshot._fromQuerySnapshot(QuerySnapshot snapshot) { final docs = snapshot.docs.map(RootQueryDocumentSnapshot._).toList(); final docChanges = snapshot.docChanges.map((change) { - return _decodeDocumentChange( - change, - RootDocumentSnapshot._, - ); + return _decodeDocumentChange(change, RootDocumentSnapshot._); }).toList(); - return RootQuerySnapshot._( - snapshot, - docs, - docChanges, - ); + return RootQuerySnapshot._(snapshot, docs, docChanges); } static FirestoreDocumentChange _decodeDocumentChange( @@ -9014,9 +9193,8 @@ class RootQueryDocumentSnapshot extends FirestoreQueryDocumentSnapshot /// (using the methods inherited from Query). abstract class SubCollectionReference implements SubQuery, FirestoreCollectionReference { - factory SubCollectionReference( - DocumentReference parent, - ) = _$SubCollectionReference; + factory SubCollectionReference(DocumentReference parent) = + _$SubCollectionReference; static Sub fromFirestore( DocumentSnapshot> snapshot, @@ -9025,10 +9203,7 @@ abstract class SubCollectionReference return Sub.fromJson(snapshot.data()!); } - static Map toFirestore( - Sub value, - SetOptions? options, - ) { + static Map toFirestore(Sub value, SetOptions? options) { return value.toJson(); } @@ -9048,22 +9223,20 @@ abstract class SubCollectionReference class _$SubCollectionReference extends _$SubQuery implements SubCollectionReference { - factory _$SubCollectionReference( - DocumentReference parent, - ) { + factory _$SubCollectionReference(DocumentReference parent) { return _$SubCollectionReference._( RootDocumentReference(parent), - parent.collection('sub').withConverter( + parent + .collection('sub') + .withConverter( fromFirestore: SubCollectionReference.fromFirestore, toFirestore: SubCollectionReference.toFirestore, ), ); } - _$SubCollectionReference._( - this.parent, - CollectionReference reference, - ) : super(reference, $referenceWithoutCursor: reference); + _$SubCollectionReference._(this.parent, CollectionReference reference) + : super(reference, $referenceWithoutCursor: reference); @override final RootDocumentReference parent; @@ -9080,9 +9253,7 @@ class _$SubCollectionReference extends _$SubQuery id == null || id.split('/').length == 1, 'The document ID cannot be from a different collection', ); - return SubDocumentReference( - reference.doc(id), - ); + return SubDocumentReference(reference.doc(id)); } @override @@ -9249,6 +9420,7 @@ class _$SubDocumentReference ...model.toJson(), if (nonNullableFieldValue != null) _$SubFieldMap['nonNullable']!: nonNullableFieldValue, + if (nullableFieldValue != null) _$SubFieldMap['nullable']!: nullableFieldValue, }; @@ -9271,6 +9443,7 @@ class _$SubDocumentReference ...model.toJson(), if (nonNullableFieldValue != null) _$SubFieldMap['nonNullable']!: nonNullableFieldValue, + if (nullableFieldValue != null) _$SubFieldMap['nullable']!: nullableFieldValue, }; @@ -9293,6 +9466,7 @@ class _$SubDocumentReference ...model.toJson(), if (nonNullableFieldValue != null) _$SubFieldMap['nonNullable']!: nonNullableFieldValue, + if (nullableFieldValue != null) _$SubFieldMap['nullable']!: nullableFieldValue, }; @@ -9320,13 +9494,18 @@ class _$SubDocumentReference ); final json = { if (nonNullable != _sentinel) - _$SubFieldMap['nonNullable']!: - _$SubPerFieldToJson.nonNullable(nonNullable as String), + _$SubFieldMap['nonNullable']!: _$SubPerFieldToJson.nonNullable( + nonNullable as String, + ), + if (nonNullableFieldValue != null) _$SubFieldMap['nonNullable']!: nonNullableFieldValue, + if (nullable != _sentinel) - _$SubFieldMap['nullable']!: - _$SubPerFieldToJson.nullable(nullable as int?), + _$SubFieldMap['nullable']!: _$SubPerFieldToJson.nullable( + nullable as int?, + ), + if (nullableFieldValue != null) _$SubFieldMap['nullable']!: nullableFieldValue, }; @@ -9351,13 +9530,18 @@ class _$SubDocumentReference ); final json = { if (nonNullable != _sentinel) - _$SubFieldMap['nonNullable']!: - _$SubPerFieldToJson.nonNullable(nonNullable as String), + _$SubFieldMap['nonNullable']!: _$SubPerFieldToJson.nonNullable( + nonNullable as String, + ), + if (nonNullableFieldValue != null) _$SubFieldMap['nonNullable']!: nonNullableFieldValue, + if (nullable != _sentinel) - _$SubFieldMap['nullable']!: - _$SubPerFieldToJson.nullable(nullable as int?), + _$SubFieldMap['nullable']!: _$SubPerFieldToJson.nullable( + nullable as int?, + ), + if (nullableFieldValue != null) _$SubFieldMap['nullable']!: nullableFieldValue, }; @@ -9382,13 +9566,18 @@ class _$SubDocumentReference ); final json = { if (nonNullable != _sentinel) - _$SubFieldMap['nonNullable']!: - _$SubPerFieldToJson.nonNullable(nonNullable as String), + _$SubFieldMap['nonNullable']!: _$SubPerFieldToJson.nonNullable( + nonNullable as String, + ), + if (nonNullableFieldValue != null) _$SubFieldMap['nonNullable']!: nonNullableFieldValue, + if (nullable != _sentinel) - _$SubFieldMap['nullable']!: - _$SubPerFieldToJson.nullable(nullable as int?), + _$SubFieldMap['nullable']!: _$SubPerFieldToJson.nullable( + nullable as int?, + ), + if (nullableFieldValue != null) _$SubFieldMap['nullable']!: nullableFieldValue, }; @@ -9560,9 +9749,9 @@ class _$SubQuery extends QueryReference required Query $referenceWithoutCursor, $QueryCursor $queryCursor = const $QueryCursor(), }) : super( - $referenceWithoutCursor: $referenceWithoutCursor, - $queryCursor: $queryCursor, - ); + $referenceWithoutCursor: $referenceWithoutCursor, + $queryCursor: $queryCursor, + ); final CollectionReference _collection; @@ -9623,7 +9812,8 @@ class _$SubQuery extends QueryReference arrayContainsAny: arrayContainsAny, whereIn: whereIn, whereNotIn: whereNotIn, - isNull: isNull ?? + isNull: + isNull ?? (isEqualTo == null ? false : null) ?? (isNotEqualTo == null ? true : null), ), @@ -9655,7 +9845,8 @@ class _$SubQuery extends QueryReference isGreaterThanOrEqualTo: isGreaterThanOrEqualTo, whereIn: whereIn, whereNotIn: whereNotIn, - isNull: isNull ?? + isNull: + isNull ?? (isEqualTo == null ? false : null) ?? (isNotEqualTo == null ? true : null), ), @@ -9699,7 +9890,8 @@ class _$SubQuery extends QueryReference : null, whereIn: whereIn?.map((e) => _$SubPerFieldToJson.nonNullable(e)), whereNotIn: whereNotIn?.map((e) => _$SubPerFieldToJson.nonNullable(e)), - isNull: isNull ?? + isNull: + isNull ?? (isEqualTo == null ? false : null) ?? (isNotEqualTo == null ? true : null), ), @@ -9743,7 +9935,8 @@ class _$SubQuery extends QueryReference : null, whereIn: whereIn?.map((e) => _$SubPerFieldToJson.nullable(e)), whereNotIn: whereNotIn?.map((e) => _$SubPerFieldToJson.nullable(e)), - isNull: isNull ?? + isNull: + isNull ?? (isEqualTo == null ? false : null) ?? (isNotEqualTo == null ? true : null), ), @@ -9764,8 +9957,10 @@ class _$SubQuery extends QueryReference SubDocumentSnapshot? endBeforeDocument, SubDocumentSnapshot? startAfterDocument, }) { - final query = - $referenceWithoutCursor.orderBy(fieldPath, descending: descending); + final query = $referenceWithoutCursor.orderBy( + fieldPath, + descending: descending, + ); var queryCursor = $queryCursor; if (startAtDocument != null) { @@ -9837,8 +10032,10 @@ class _$SubQuery extends QueryReference SubDocumentSnapshot? endBeforeDocument, SubDocumentSnapshot? startAfterDocument, }) { - final query = $referenceWithoutCursor.orderBy(FieldPath.documentId, - descending: descending); + final query = $referenceWithoutCursor.orderBy( + FieldPath.documentId, + descending: descending, + ); var queryCursor = $queryCursor; if (startAtDocument != null) { @@ -9910,8 +10107,10 @@ class _$SubQuery extends QueryReference SubDocumentSnapshot? endBeforeDocument, SubDocumentSnapshot? startAfterDocument, }) { - final query = $referenceWithoutCursor.orderBy(_$SubFieldMap['nonNullable']!, - descending: descending); + final query = $referenceWithoutCursor.orderBy( + _$SubFieldMap['nonNullable']!, + descending: descending, + ); var queryCursor = $queryCursor; if (startAtDocument != null) { @@ -9943,7 +10142,7 @@ class _$SubQuery extends QueryReference queryCursor = queryCursor.copyWith( startAt: [ ...queryCursor.startAt, - _$SubPerFieldToJson.nonNullable(startAt as String) + _$SubPerFieldToJson.nonNullable(startAt as String), ], startAtDocumentSnapshot: null, ); @@ -9952,7 +10151,7 @@ class _$SubQuery extends QueryReference queryCursor = queryCursor.copyWith( startAfter: [ ...queryCursor.startAfter, - _$SubPerFieldToJson.nonNullable(startAfter as String) + _$SubPerFieldToJson.nonNullable(startAfter as String), ], startAfterDocumentSnapshot: null, ); @@ -9961,7 +10160,7 @@ class _$SubQuery extends QueryReference queryCursor = queryCursor.copyWith( endAt: [ ...queryCursor.endAt, - _$SubPerFieldToJson.nonNullable(endAt as String) + _$SubPerFieldToJson.nonNullable(endAt as String), ], endAtDocumentSnapshot: null, ); @@ -9970,7 +10169,7 @@ class _$SubQuery extends QueryReference queryCursor = queryCursor.copyWith( endBefore: [ ...queryCursor.endBefore, - _$SubPerFieldToJson.nonNullable(endBefore as String) + _$SubPerFieldToJson.nonNullable(endBefore as String), ], endBeforeDocumentSnapshot: null, ); @@ -9995,8 +10194,10 @@ class _$SubQuery extends QueryReference SubDocumentSnapshot? endBeforeDocument, SubDocumentSnapshot? startAfterDocument, }) { - final query = $referenceWithoutCursor.orderBy(_$SubFieldMap['nullable']!, - descending: descending); + final query = $referenceWithoutCursor.orderBy( + _$SubFieldMap['nullable']!, + descending: descending, + ); var queryCursor = $queryCursor; if (startAtDocument != null) { @@ -10028,7 +10229,7 @@ class _$SubQuery extends QueryReference queryCursor = queryCursor.copyWith( startAt: [ ...queryCursor.startAt, - _$SubPerFieldToJson.nullable(startAt as int?) + _$SubPerFieldToJson.nullable(startAt as int?), ], startAtDocumentSnapshot: null, ); @@ -10037,7 +10238,7 @@ class _$SubQuery extends QueryReference queryCursor = queryCursor.copyWith( startAfter: [ ...queryCursor.startAfter, - _$SubPerFieldToJson.nullable(startAfter as int?) + _$SubPerFieldToJson.nullable(startAfter as int?), ], startAfterDocumentSnapshot: null, ); @@ -10046,7 +10247,7 @@ class _$SubQuery extends QueryReference queryCursor = queryCursor.copyWith( endAt: [ ...queryCursor.endAt, - _$SubPerFieldToJson.nullable(endAt as int?) + _$SubPerFieldToJson.nullable(endAt as int?), ], endAtDocumentSnapshot: null, ); @@ -10055,7 +10256,7 @@ class _$SubQuery extends QueryReference queryCursor = queryCursor.copyWith( endBefore: [ ...queryCursor.endBefore, - _$SubPerFieldToJson.nullable(endBefore as int?) + _$SubPerFieldToJson.nullable(endBefore as int?), ], endBeforeDocumentSnapshot: null, ); @@ -10087,9 +10288,7 @@ class SubDocumentSnapshot extends FirestoreDocumentSnapshot { @override SubDocumentReference get reference { - return SubDocumentReference( - snapshot.reference, - ); + return SubDocumentReference(snapshot.reference); } @override @@ -10098,29 +10297,16 @@ class SubDocumentSnapshot extends FirestoreDocumentSnapshot { class SubQuerySnapshot extends FirestoreQuerySnapshot { - SubQuerySnapshot._( - this.snapshot, - this.docs, - this.docChanges, - ); - - factory SubQuerySnapshot._fromQuerySnapshot( - QuerySnapshot snapshot, - ) { + SubQuerySnapshot._(this.snapshot, this.docs, this.docChanges); + + factory SubQuerySnapshot._fromQuerySnapshot(QuerySnapshot snapshot) { final docs = snapshot.docs.map(SubQueryDocumentSnapshot._).toList(); final docChanges = snapshot.docChanges.map((change) { - return _decodeDocumentChange( - change, - SubDocumentSnapshot._, - ); + return _decodeDocumentChange(change, SubDocumentSnapshot._); }).toList(); - return SubQuerySnapshot._( - snapshot, - docs, - docChanges, - ); + return SubQuerySnapshot._(snapshot, docs, docChanges); } static FirestoreDocumentChange _decodeDocumentChange( @@ -10167,9 +10353,8 @@ abstract class AsCamelCaseCollectionReference implements AsCamelCaseQuery, FirestoreCollectionReference { - factory AsCamelCaseCollectionReference( - DocumentReference parent, - ) = _$AsCamelCaseCollectionReference; + factory AsCamelCaseCollectionReference(DocumentReference parent) = + _$AsCamelCaseCollectionReference; static AsCamelCase fromFirestore( DocumentSnapshot> snapshot, @@ -10201,12 +10386,12 @@ abstract class AsCamelCaseCollectionReference class _$AsCamelCaseCollectionReference extends _$AsCamelCaseQuery implements AsCamelCaseCollectionReference { - factory _$AsCamelCaseCollectionReference( - DocumentReference parent, - ) { + factory _$AsCamelCaseCollectionReference(DocumentReference parent) { return _$AsCamelCaseCollectionReference._( RootDocumentReference(parent), - parent.collection('as-camel-case').withConverter( + parent + .collection('as-camel-case') + .withConverter( fromFirestore: AsCamelCaseCollectionReference.fromFirestore, toFirestore: AsCamelCaseCollectionReference.toFirestore, ), @@ -10233,9 +10418,7 @@ class _$AsCamelCaseCollectionReference extends _$AsCamelCaseQuery id == null || id.split('/').length == 1, 'The document ID cannot be from a different collection', ); - return AsCamelCaseDocumentReference( - reference.doc(id), - ); + return AsCamelCaseDocumentReference(reference.doc(id)); } @override @@ -10256,11 +10439,12 @@ class _$AsCamelCaseCollectionReference extends _$AsCamelCaseQuery int get hashCode => Object.hash(runtimeType, reference); } -abstract class AsCamelCaseDocumentReference extends FirestoreDocumentReference< - AsCamelCase, AsCamelCaseDocumentSnapshot> { +abstract class AsCamelCaseDocumentReference + extends + FirestoreDocumentReference { factory AsCamelCaseDocumentReference( - DocumentReference reference) = - _$AsCamelCaseDocumentReference; + DocumentReference reference, + ) = _$AsCamelCaseDocumentReference; DocumentReference get reference; @@ -10329,10 +10513,7 @@ abstract class AsCamelCaseDocumentReference extends FirestoreDocumentReference< /// document data. /// /// If no document exists yet, the update will fail. - Future update({ - num value, - FieldValue valueFieldValue, - }); + Future update({num value, FieldValue valueFieldValue}); /// Updates fields in the current document using the transaction API. /// @@ -10346,11 +10527,7 @@ abstract class AsCamelCaseDocumentReference extends FirestoreDocumentReference< /// Updates fields in the current document using the batch API. /// /// The update will fail if applied to a document that does not exist. - void batchUpdate( - WriteBatch batch, { - num value, - FieldValue valueFieldValue, - }); + void batchUpdate(WriteBatch batch, {num value, FieldValue valueFieldValue}); } class _$AsCamelCaseDocumentReference @@ -10452,8 +10629,10 @@ class _$AsCamelCaseDocumentReference ); final json = { if (value != _sentinel) - _$AsCamelCaseFieldMap['value']!: - _$AsCamelCasePerFieldToJson.value(value as num), + _$AsCamelCaseFieldMap['value']!: _$AsCamelCasePerFieldToJson.value( + value as num, + ), + if (valueFieldValue != null) _$AsCamelCaseFieldMap['value']!: valueFieldValue, }; @@ -10472,8 +10651,10 @@ class _$AsCamelCaseDocumentReference ); final json = { if (value != _sentinel) - _$AsCamelCaseFieldMap['value']!: - _$AsCamelCasePerFieldToJson.value(value as num), + _$AsCamelCaseFieldMap['value']!: _$AsCamelCasePerFieldToJson.value( + value as num, + ), + if (valueFieldValue != null) _$AsCamelCaseFieldMap['value']!: valueFieldValue, }; @@ -10492,8 +10673,10 @@ class _$AsCamelCaseDocumentReference ); final json = { if (value != _sentinel) - _$AsCamelCaseFieldMap['value']!: - _$AsCamelCasePerFieldToJson.value(value as num), + _$AsCamelCaseFieldMap['value']!: _$AsCamelCasePerFieldToJson.value( + value as num, + ), + if (valueFieldValue != null) _$AsCamelCaseFieldMap['value']!: valueFieldValue, }; @@ -10643,17 +10826,17 @@ class _$AsCamelCaseQuery required Query $referenceWithoutCursor, $QueryCursor $queryCursor = const $QueryCursor(), }) : super( - $referenceWithoutCursor: $referenceWithoutCursor, - $queryCursor: $queryCursor, - ); + $referenceWithoutCursor: $referenceWithoutCursor, + $queryCursor: $queryCursor, + ); final CollectionReference _collection; @override Stream snapshots([SnapshotOptions? options]) { - return reference - .snapshots() - .map(AsCamelCaseQuerySnapshot._fromQuerySnapshot); + return reference.snapshots().map( + AsCamelCaseQuerySnapshot._fromQuerySnapshot, + ); } @override @@ -10710,7 +10893,8 @@ class _$AsCamelCaseQuery arrayContainsAny: arrayContainsAny, whereIn: whereIn, whereNotIn: whereNotIn, - isNull: isNull ?? + isNull: + isNull ?? (isEqualTo == null ? false : null) ?? (isNotEqualTo == null ? true : null), ), @@ -10742,7 +10926,8 @@ class _$AsCamelCaseQuery isGreaterThanOrEqualTo: isGreaterThanOrEqualTo, whereIn: whereIn, whereNotIn: whereNotIn, - isNull: isNull ?? + isNull: + isNull ?? (isEqualTo == null ? false : null) ?? (isNotEqualTo == null ? true : null), ), @@ -10785,9 +10970,11 @@ class _$AsCamelCaseQuery ? _$AsCamelCasePerFieldToJson.value(isGreaterThanOrEqualTo as num) : null, whereIn: whereIn?.map((e) => _$AsCamelCasePerFieldToJson.value(e)), - whereNotIn: - whereNotIn?.map((e) => _$AsCamelCasePerFieldToJson.value(e)), - isNull: isNull ?? + whereNotIn: whereNotIn?.map( + (e) => _$AsCamelCasePerFieldToJson.value(e), + ), + isNull: + isNull ?? (isEqualTo == null ? false : null) ?? (isNotEqualTo == null ? true : null), ), @@ -10808,8 +10995,10 @@ class _$AsCamelCaseQuery AsCamelCaseDocumentSnapshot? endBeforeDocument, AsCamelCaseDocumentSnapshot? startAfterDocument, }) { - final query = - $referenceWithoutCursor.orderBy(fieldPath, descending: descending); + final query = $referenceWithoutCursor.orderBy( + fieldPath, + descending: descending, + ); var queryCursor = $queryCursor; if (startAtDocument != null) { @@ -10881,8 +11070,10 @@ class _$AsCamelCaseQuery AsCamelCaseDocumentSnapshot? endBeforeDocument, AsCamelCaseDocumentSnapshot? startAfterDocument, }) { - final query = $referenceWithoutCursor.orderBy(FieldPath.documentId, - descending: descending); + final query = $referenceWithoutCursor.orderBy( + FieldPath.documentId, + descending: descending, + ); var queryCursor = $queryCursor; if (startAtDocument != null) { @@ -10954,8 +11145,10 @@ class _$AsCamelCaseQuery AsCamelCaseDocumentSnapshot? endBeforeDocument, AsCamelCaseDocumentSnapshot? startAfterDocument, }) { - final query = $referenceWithoutCursor - .orderBy(_$AsCamelCaseFieldMap['value']!, descending: descending); + final query = $referenceWithoutCursor.orderBy( + _$AsCamelCaseFieldMap['value']!, + descending: descending, + ); var queryCursor = $queryCursor; if (startAtDocument != null) { @@ -10987,7 +11180,7 @@ class _$AsCamelCaseQuery queryCursor = queryCursor.copyWith( startAt: [ ...queryCursor.startAt, - _$AsCamelCasePerFieldToJson.value(startAt as num) + _$AsCamelCasePerFieldToJson.value(startAt as num), ], startAtDocumentSnapshot: null, ); @@ -10996,7 +11189,7 @@ class _$AsCamelCaseQuery queryCursor = queryCursor.copyWith( startAfter: [ ...queryCursor.startAfter, - _$AsCamelCasePerFieldToJson.value(startAfter as num) + _$AsCamelCasePerFieldToJson.value(startAfter as num), ], startAfterDocumentSnapshot: null, ); @@ -11005,7 +11198,7 @@ class _$AsCamelCaseQuery queryCursor = queryCursor.copyWith( endAt: [ ...queryCursor.endAt, - _$AsCamelCasePerFieldToJson.value(endAt as num) + _$AsCamelCasePerFieldToJson.value(endAt as num), ], endAtDocumentSnapshot: null, ); @@ -11014,7 +11207,7 @@ class _$AsCamelCaseQuery queryCursor = queryCursor.copyWith( endBefore: [ ...queryCursor.endBefore, - _$AsCamelCasePerFieldToJson.value(endBefore as num) + _$AsCamelCasePerFieldToJson.value(endBefore as num), ], endBeforeDocumentSnapshot: null, ); @@ -11047,22 +11240,17 @@ class AsCamelCaseDocumentSnapshot @override AsCamelCaseDocumentReference get reference { - return AsCamelCaseDocumentReference( - snapshot.reference, - ); + return AsCamelCaseDocumentReference(snapshot.reference); } @override final AsCamelCase? data; } -class AsCamelCaseQuerySnapshot extends FirestoreQuerySnapshot { - AsCamelCaseQuerySnapshot._( - this.snapshot, - this.docs, - this.docChanges, - ); +class AsCamelCaseQuerySnapshot + extends + FirestoreQuerySnapshot { + AsCamelCaseQuerySnapshot._(this.snapshot, this.docs, this.docChanges); factory AsCamelCaseQuerySnapshot._fromQuerySnapshot( QuerySnapshot snapshot, @@ -11070,21 +11258,14 @@ class AsCamelCaseQuerySnapshot extends FirestoreQuerySnapshot - _decodeDocumentChange( + _decodeDocumentChange( DocumentChange docChange, AsCamelCaseDocumentSnapshot Function(DocumentSnapshot doc) decodeDoc, ) { @@ -11128,11 +11309,12 @@ class AsCamelCaseQueryDocumentSnapshot abstract class CustomSubNameCollectionReference implements CustomSubNameQuery, - FirestoreCollectionReference { - factory CustomSubNameCollectionReference( - DocumentReference parent, - ) = _$CustomSubNameCollectionReference; + FirestoreCollectionReference< + CustomSubName, + CustomSubNameQuerySnapshot + > { + factory CustomSubNameCollectionReference(DocumentReference parent) = + _$CustomSubNameCollectionReference; static CustomSubName fromFirestore( DocumentSnapshot> snapshot, @@ -11164,12 +11346,12 @@ abstract class CustomSubNameCollectionReference class _$CustomSubNameCollectionReference extends _$CustomSubNameQuery implements CustomSubNameCollectionReference { - factory _$CustomSubNameCollectionReference( - DocumentReference parent, - ) { + factory _$CustomSubNameCollectionReference(DocumentReference parent) { return _$CustomSubNameCollectionReference._( RootDocumentReference(parent), - parent.collection('custom-sub-name').withConverter( + parent + .collection('custom-sub-name') + .withConverter( fromFirestore: CustomSubNameCollectionReference.fromFirestore, toFirestore: CustomSubNameCollectionReference.toFirestore, ), @@ -11196,9 +11378,7 @@ class _$CustomSubNameCollectionReference extends _$CustomSubNameQuery id == null || id.split('/').length == 1, 'The document ID cannot be from a different collection', ); - return CustomSubNameDocumentReference( - reference.doc(id), - ); + return CustomSubNameDocumentReference(reference.doc(id)); } @override @@ -11220,11 +11400,14 @@ class _$CustomSubNameCollectionReference extends _$CustomSubNameQuery } abstract class CustomSubNameDocumentReference - extends FirestoreDocumentReference { + extends + FirestoreDocumentReference< + CustomSubName, + CustomSubNameDocumentSnapshot + > { factory CustomSubNameDocumentReference( - DocumentReference reference) = - _$CustomSubNameDocumentReference; + DocumentReference reference, + ) = _$CustomSubNameDocumentReference; DocumentReference get reference; @@ -11293,10 +11476,7 @@ abstract class CustomSubNameDocumentReference /// document data. /// /// If no document exists yet, the update will fail. - Future update({ - num value, - FieldValue valueFieldValue, - }); + Future update({num value, FieldValue valueFieldValue}); /// Updates fields in the current document using the transaction API. /// @@ -11310,16 +11490,13 @@ abstract class CustomSubNameDocumentReference /// Updates fields in the current document using the batch API. /// /// The update will fail if applied to a document that does not exist. - void batchUpdate( - WriteBatch batch, { - num value, - FieldValue valueFieldValue, - }); + void batchUpdate(WriteBatch batch, {num value, FieldValue valueFieldValue}); } -class _$CustomSubNameDocumentReference extends FirestoreDocumentReference< - CustomSubName, - CustomSubNameDocumentSnapshot> implements CustomSubNameDocumentReference { +class _$CustomSubNameDocumentReference + extends + FirestoreDocumentReference + implements CustomSubNameDocumentReference { _$CustomSubNameDocumentReference(this.reference); @override @@ -11347,7 +11524,8 @@ class _$CustomSubNameDocumentReference extends FirestoreDocumentReference< @override Future transactionGet( - Transaction transaction) { + Transaction transaction, + ) { return transaction.get(reference).then(CustomSubNameDocumentSnapshot._); } @@ -11417,8 +11595,10 @@ class _$CustomSubNameDocumentReference extends FirestoreDocumentReference< ); final json = { if (value != _sentinel) - _$CustomSubNameFieldMap['value']!: - _$CustomSubNamePerFieldToJson.value(value as num), + _$CustomSubNameFieldMap['value']!: _$CustomSubNamePerFieldToJson.value( + value as num, + ), + if (valueFieldValue != null) _$CustomSubNameFieldMap['value']!: valueFieldValue, }; @@ -11437,8 +11617,10 @@ class _$CustomSubNameDocumentReference extends FirestoreDocumentReference< ); final json = { if (value != _sentinel) - _$CustomSubNameFieldMap['value']!: - _$CustomSubNamePerFieldToJson.value(value as num), + _$CustomSubNameFieldMap['value']!: _$CustomSubNamePerFieldToJson.value( + value as num, + ), + if (valueFieldValue != null) _$CustomSubNameFieldMap['value']!: valueFieldValue, }; @@ -11457,8 +11639,10 @@ class _$CustomSubNameDocumentReference extends FirestoreDocumentReference< ); final json = { if (value != _sentinel) - _$CustomSubNameFieldMap['value']!: - _$CustomSubNamePerFieldToJson.value(value as num), + _$CustomSubNameFieldMap['value']!: _$CustomSubNamePerFieldToJson.value( + value as num, + ), + if (valueFieldValue != null) _$CustomSubNameFieldMap['value']!: valueFieldValue, }; @@ -11608,17 +11792,17 @@ class _$CustomSubNameQuery required Query $referenceWithoutCursor, $QueryCursor $queryCursor = const $QueryCursor(), }) : super( - $referenceWithoutCursor: $referenceWithoutCursor, - $queryCursor: $queryCursor, - ); + $referenceWithoutCursor: $referenceWithoutCursor, + $queryCursor: $queryCursor, + ); final CollectionReference _collection; @override Stream snapshots([SnapshotOptions? options]) { - return reference - .snapshots() - .map(CustomSubNameQuerySnapshot._fromQuerySnapshot); + return reference.snapshots().map( + CustomSubNameQuerySnapshot._fromQuerySnapshot, + ); } @override @@ -11675,7 +11859,8 @@ class _$CustomSubNameQuery arrayContainsAny: arrayContainsAny, whereIn: whereIn, whereNotIn: whereNotIn, - isNull: isNull ?? + isNull: + isNull ?? (isEqualTo == null ? false : null) ?? (isNotEqualTo == null ? true : null), ), @@ -11707,7 +11892,8 @@ class _$CustomSubNameQuery isGreaterThanOrEqualTo: isGreaterThanOrEqualTo, whereIn: whereIn, whereNotIn: whereNotIn, - isNull: isNull ?? + isNull: + isNull ?? (isEqualTo == null ? false : null) ?? (isNotEqualTo == null ? true : null), ), @@ -11750,9 +11936,11 @@ class _$CustomSubNameQuery ? _$CustomSubNamePerFieldToJson.value(isGreaterThanOrEqualTo as num) : null, whereIn: whereIn?.map((e) => _$CustomSubNamePerFieldToJson.value(e)), - whereNotIn: - whereNotIn?.map((e) => _$CustomSubNamePerFieldToJson.value(e)), - isNull: isNull ?? + whereNotIn: whereNotIn?.map( + (e) => _$CustomSubNamePerFieldToJson.value(e), + ), + isNull: + isNull ?? (isEqualTo == null ? false : null) ?? (isNotEqualTo == null ? true : null), ), @@ -11773,8 +11961,10 @@ class _$CustomSubNameQuery CustomSubNameDocumentSnapshot? endBeforeDocument, CustomSubNameDocumentSnapshot? startAfterDocument, }) { - final query = - $referenceWithoutCursor.orderBy(fieldPath, descending: descending); + final query = $referenceWithoutCursor.orderBy( + fieldPath, + descending: descending, + ); var queryCursor = $queryCursor; if (startAtDocument != null) { @@ -11846,8 +12036,10 @@ class _$CustomSubNameQuery CustomSubNameDocumentSnapshot? endBeforeDocument, CustomSubNameDocumentSnapshot? startAfterDocument, }) { - final query = $referenceWithoutCursor.orderBy(FieldPath.documentId, - descending: descending); + final query = $referenceWithoutCursor.orderBy( + FieldPath.documentId, + descending: descending, + ); var queryCursor = $queryCursor; if (startAtDocument != null) { @@ -11919,8 +12111,10 @@ class _$CustomSubNameQuery CustomSubNameDocumentSnapshot? endBeforeDocument, CustomSubNameDocumentSnapshot? startAfterDocument, }) { - final query = $referenceWithoutCursor - .orderBy(_$CustomSubNameFieldMap['value']!, descending: descending); + final query = $referenceWithoutCursor.orderBy( + _$CustomSubNameFieldMap['value']!, + descending: descending, + ); var queryCursor = $queryCursor; if (startAtDocument != null) { @@ -11952,7 +12146,7 @@ class _$CustomSubNameQuery queryCursor = queryCursor.copyWith( startAt: [ ...queryCursor.startAt, - _$CustomSubNamePerFieldToJson.value(startAt as num) + _$CustomSubNamePerFieldToJson.value(startAt as num), ], startAtDocumentSnapshot: null, ); @@ -11961,7 +12155,7 @@ class _$CustomSubNameQuery queryCursor = queryCursor.copyWith( startAfter: [ ...queryCursor.startAfter, - _$CustomSubNamePerFieldToJson.value(startAfter as num) + _$CustomSubNamePerFieldToJson.value(startAfter as num), ], startAfterDocumentSnapshot: null, ); @@ -11970,7 +12164,7 @@ class _$CustomSubNameQuery queryCursor = queryCursor.copyWith( endAt: [ ...queryCursor.endAt, - _$CustomSubNamePerFieldToJson.value(endAt as num) + _$CustomSubNamePerFieldToJson.value(endAt as num), ], endAtDocumentSnapshot: null, ); @@ -11979,7 +12173,7 @@ class _$CustomSubNameQuery queryCursor = queryCursor.copyWith( endBefore: [ ...queryCursor.endBefore, - _$CustomSubNamePerFieldToJson.value(endBefore as num) + _$CustomSubNamePerFieldToJson.value(endBefore as num), ], endBeforeDocumentSnapshot: null, ); @@ -12012,45 +12206,37 @@ class CustomSubNameDocumentSnapshot @override CustomSubNameDocumentReference get reference { - return CustomSubNameDocumentReference( - snapshot.reference, - ); + return CustomSubNameDocumentReference(snapshot.reference); } @override final CustomSubName? data; } -class CustomSubNameQuerySnapshot extends FirestoreQuerySnapshot { - CustomSubNameQuerySnapshot._( - this.snapshot, - this.docs, - this.docChanges, - ); +class CustomSubNameQuerySnapshot + extends + FirestoreQuerySnapshot< + CustomSubName, + CustomSubNameQueryDocumentSnapshot + > { + CustomSubNameQuerySnapshot._(this.snapshot, this.docs, this.docChanges); factory CustomSubNameQuerySnapshot._fromQuerySnapshot( QuerySnapshot snapshot, ) { - final docs = - snapshot.docs.map(CustomSubNameQueryDocumentSnapshot._).toList(); + final docs = snapshot.docs + .map(CustomSubNameQueryDocumentSnapshot._) + .toList(); final docChanges = snapshot.docChanges.map((change) { - return _decodeDocumentChange( - change, - CustomSubNameDocumentSnapshot._, - ); + return _decodeDocumentChange(change, CustomSubNameDocumentSnapshot._); }).toList(); - return CustomSubNameQuerySnapshot._( - snapshot, - docs, - docChanges, - ); + return CustomSubNameQuerySnapshot._(snapshot, docs, docChanges); } static FirestoreDocumentChange - _decodeDocumentChange( + _decodeDocumentChange( DocumentChange docChange, CustomSubNameDocumentSnapshot Function(DocumentSnapshot doc) decodeDoc, ) { @@ -12094,8 +12280,10 @@ class CustomSubNameQueryDocumentSnapshot abstract class ThisIsACustomPrefixCollectionReference implements ThisIsACustomPrefixQuery, - FirestoreCollectionReference { + FirestoreCollectionReference< + CustomClassPrefix, + ThisIsACustomPrefixQuerySnapshot + > { factory ThisIsACustomPrefixCollectionReference( DocumentReference parent, ) = _$ThisIsACustomPrefixCollectionReference; @@ -12136,7 +12324,9 @@ class _$ThisIsACustomPrefixCollectionReference ) { return _$ThisIsACustomPrefixCollectionReference._( RootDocumentReference(parent), - parent.collection('custom-class-prefix').withConverter( + parent + .collection('custom-class-prefix') + .withConverter( fromFirestore: ThisIsACustomPrefixCollectionReference.fromFirestore, toFirestore: ThisIsACustomPrefixCollectionReference.toFirestore, ), @@ -12163,9 +12353,7 @@ class _$ThisIsACustomPrefixCollectionReference id == null || id.split('/').length == 1, 'The document ID cannot be from a different collection', ); - return ThisIsACustomPrefixDocumentReference( - reference.doc(id), - ); + return ThisIsACustomPrefixDocumentReference(reference.doc(id)); } @override @@ -12187,11 +12375,14 @@ class _$ThisIsACustomPrefixCollectionReference } abstract class ThisIsACustomPrefixDocumentReference - extends FirestoreDocumentReference { + extends + FirestoreDocumentReference< + CustomClassPrefix, + ThisIsACustomPrefixDocumentSnapshot + > { factory ThisIsACustomPrefixDocumentReference( - DocumentReference reference) = - _$ThisIsACustomPrefixDocumentReference; + DocumentReference reference, + ) = _$ThisIsACustomPrefixDocumentReference; DocumentReference get reference; @@ -12260,10 +12451,7 @@ abstract class ThisIsACustomPrefixDocumentReference /// document data. /// /// If no document exists yet, the update will fail. - Future update({ - num value, - FieldValue valueFieldValue, - }); + Future update({num value, FieldValue valueFieldValue}); /// Updates fields in the current document using the transaction API. /// @@ -12277,15 +12465,15 @@ abstract class ThisIsACustomPrefixDocumentReference /// Updates fields in the current document using the batch API. /// /// The update will fail if applied to a document that does not exist. - void batchUpdate( - WriteBatch batch, { - num value, - FieldValue valueFieldValue, - }); + void batchUpdate(WriteBatch batch, {num value, FieldValue valueFieldValue}); } -class _$ThisIsACustomPrefixDocumentReference extends FirestoreDocumentReference< - CustomClassPrefix, ThisIsACustomPrefixDocumentSnapshot> +class _$ThisIsACustomPrefixDocumentReference + extends + FirestoreDocumentReference< + CustomClassPrefix, + ThisIsACustomPrefixDocumentSnapshot + > implements ThisIsACustomPrefixDocumentReference { _$ThisIsACustomPrefixDocumentReference(this.reference); @@ -12314,7 +12502,8 @@ class _$ThisIsACustomPrefixDocumentReference extends FirestoreDocumentReference< @override Future transactionGet( - Transaction transaction) { + Transaction transaction, + ) { return transaction .get(reference) .then(ThisIsACustomPrefixDocumentSnapshot._); @@ -12386,8 +12575,9 @@ class _$ThisIsACustomPrefixDocumentReference extends FirestoreDocumentReference< ); final json = { if (value != _sentinel) - _$CustomClassPrefixFieldMap['value']!: - _$CustomClassPrefixPerFieldToJson.value(value as num), + _$CustomClassPrefixFieldMap['value']!: _$CustomClassPrefixPerFieldToJson + .value(value as num), + if (valueFieldValue != null) _$CustomClassPrefixFieldMap['value']!: valueFieldValue, }; @@ -12406,8 +12596,9 @@ class _$ThisIsACustomPrefixDocumentReference extends FirestoreDocumentReference< ); final json = { if (value != _sentinel) - _$CustomClassPrefixFieldMap['value']!: - _$CustomClassPrefixPerFieldToJson.value(value as num), + _$CustomClassPrefixFieldMap['value']!: _$CustomClassPrefixPerFieldToJson + .value(value as num), + if (valueFieldValue != null) _$CustomClassPrefixFieldMap['value']!: valueFieldValue, }; @@ -12426,8 +12617,9 @@ class _$ThisIsACustomPrefixDocumentReference extends FirestoreDocumentReference< ); final json = { if (value != _sentinel) - _$CustomClassPrefixFieldMap['value']!: - _$CustomClassPrefixPerFieldToJson.value(value as num), + _$CustomClassPrefixFieldMap['value']!: _$CustomClassPrefixPerFieldToJson + .value(value as num), + if (valueFieldValue != null) _$CustomClassPrefixFieldMap['value']!: valueFieldValue, }; @@ -12578,18 +12770,19 @@ class _$ThisIsACustomPrefixQuery required Query $referenceWithoutCursor, $QueryCursor $queryCursor = const $QueryCursor(), }) : super( - $referenceWithoutCursor: $referenceWithoutCursor, - $queryCursor: $queryCursor, - ); + $referenceWithoutCursor: $referenceWithoutCursor, + $queryCursor: $queryCursor, + ); final CollectionReference _collection; @override - Stream snapshots( - [SnapshotOptions? options]) { - return reference - .snapshots() - .map(ThisIsACustomPrefixQuerySnapshot._fromQuerySnapshot); + Stream snapshots([ + SnapshotOptions? options, + ]) { + return reference.snapshots().map( + ThisIsACustomPrefixQuerySnapshot._fromQuerySnapshot, + ); } @override @@ -12646,7 +12839,8 @@ class _$ThisIsACustomPrefixQuery arrayContainsAny: arrayContainsAny, whereIn: whereIn, whereNotIn: whereNotIn, - isNull: isNull ?? + isNull: + isNull ?? (isEqualTo == null ? false : null) ?? (isNotEqualTo == null ? true : null), ), @@ -12678,7 +12872,8 @@ class _$ThisIsACustomPrefixQuery isGreaterThanOrEqualTo: isGreaterThanOrEqualTo, whereIn: whereIn, whereNotIn: whereNotIn, - isNull: isNull ?? + isNull: + isNull ?? (isEqualTo == null ? false : null) ?? (isNotEqualTo == null ? true : null), ), @@ -12712,21 +12907,26 @@ class _$ThisIsACustomPrefixQuery ? _$CustomClassPrefixPerFieldToJson.value(isLessThan as num) : null, isLessThanOrEqualTo: isLessThanOrEqualTo != null - ? _$CustomClassPrefixPerFieldToJson - .value(isLessThanOrEqualTo as num) + ? _$CustomClassPrefixPerFieldToJson.value( + isLessThanOrEqualTo as num, + ) : null, isGreaterThan: isGreaterThan != null ? _$CustomClassPrefixPerFieldToJson.value(isGreaterThan as num) : null, isGreaterThanOrEqualTo: isGreaterThanOrEqualTo != null - ? _$CustomClassPrefixPerFieldToJson - .value(isGreaterThanOrEqualTo as num) - : null, - whereIn: - whereIn?.map((e) => _$CustomClassPrefixPerFieldToJson.value(e)), - whereNotIn: - whereNotIn?.map((e) => _$CustomClassPrefixPerFieldToJson.value(e)), - isNull: isNull ?? + ? _$CustomClassPrefixPerFieldToJson.value( + isGreaterThanOrEqualTo as num, + ) + : null, + whereIn: whereIn?.map( + (e) => _$CustomClassPrefixPerFieldToJson.value(e), + ), + whereNotIn: whereNotIn?.map( + (e) => _$CustomClassPrefixPerFieldToJson.value(e), + ), + isNull: + isNull ?? (isEqualTo == null ? false : null) ?? (isNotEqualTo == null ? true : null), ), @@ -12747,8 +12947,10 @@ class _$ThisIsACustomPrefixQuery ThisIsACustomPrefixDocumentSnapshot? endBeforeDocument, ThisIsACustomPrefixDocumentSnapshot? startAfterDocument, }) { - final query = - $referenceWithoutCursor.orderBy(fieldPath, descending: descending); + final query = $referenceWithoutCursor.orderBy( + fieldPath, + descending: descending, + ); var queryCursor = $queryCursor; if (startAtDocument != null) { @@ -12820,8 +13022,10 @@ class _$ThisIsACustomPrefixQuery ThisIsACustomPrefixDocumentSnapshot? endBeforeDocument, ThisIsACustomPrefixDocumentSnapshot? startAfterDocument, }) { - final query = $referenceWithoutCursor.orderBy(FieldPath.documentId, - descending: descending); + final query = $referenceWithoutCursor.orderBy( + FieldPath.documentId, + descending: descending, + ); var queryCursor = $queryCursor; if (startAtDocument != null) { @@ -12893,8 +13097,10 @@ class _$ThisIsACustomPrefixQuery ThisIsACustomPrefixDocumentSnapshot? endBeforeDocument, ThisIsACustomPrefixDocumentSnapshot? startAfterDocument, }) { - final query = $referenceWithoutCursor - .orderBy(_$CustomClassPrefixFieldMap['value']!, descending: descending); + final query = $referenceWithoutCursor.orderBy( + _$CustomClassPrefixFieldMap['value']!, + descending: descending, + ); var queryCursor = $queryCursor; if (startAtDocument != null) { @@ -12926,7 +13132,7 @@ class _$ThisIsACustomPrefixQuery queryCursor = queryCursor.copyWith( startAt: [ ...queryCursor.startAt, - _$CustomClassPrefixPerFieldToJson.value(startAt as num) + _$CustomClassPrefixPerFieldToJson.value(startAt as num), ], startAtDocumentSnapshot: null, ); @@ -12935,7 +13141,7 @@ class _$ThisIsACustomPrefixQuery queryCursor = queryCursor.copyWith( startAfter: [ ...queryCursor.startAfter, - _$CustomClassPrefixPerFieldToJson.value(startAfter as num) + _$CustomClassPrefixPerFieldToJson.value(startAfter as num), ], startAfterDocumentSnapshot: null, ); @@ -12944,7 +13150,7 @@ class _$ThisIsACustomPrefixQuery queryCursor = queryCursor.copyWith( endAt: [ ...queryCursor.endAt, - _$CustomClassPrefixPerFieldToJson.value(endAt as num) + _$CustomClassPrefixPerFieldToJson.value(endAt as num), ], endAtDocumentSnapshot: null, ); @@ -12953,7 +13159,7 @@ class _$ThisIsACustomPrefixQuery queryCursor = queryCursor.copyWith( endBefore: [ ...queryCursor.endBefore, - _$CustomClassPrefixPerFieldToJson.value(endBefore as num) + _$CustomClassPrefixPerFieldToJson.value(endBefore as num), ], endBeforeDocumentSnapshot: null, ); @@ -12986,28 +13192,27 @@ class ThisIsACustomPrefixDocumentSnapshot @override ThisIsACustomPrefixDocumentReference get reference { - return ThisIsACustomPrefixDocumentReference( - snapshot.reference, - ); + return ThisIsACustomPrefixDocumentReference(snapshot.reference); } @override final CustomClassPrefix? data; } -class ThisIsACustomPrefixQuerySnapshot extends FirestoreQuerySnapshot< - CustomClassPrefix, ThisIsACustomPrefixQueryDocumentSnapshot> { - ThisIsACustomPrefixQuerySnapshot._( - this.snapshot, - this.docs, - this.docChanges, - ); +class ThisIsACustomPrefixQuerySnapshot + extends + FirestoreQuerySnapshot< + CustomClassPrefix, + ThisIsACustomPrefixQueryDocumentSnapshot + > { + ThisIsACustomPrefixQuerySnapshot._(this.snapshot, this.docs, this.docChanges); factory ThisIsACustomPrefixQuerySnapshot._fromQuerySnapshot( QuerySnapshot snapshot, ) { - final docs = - snapshot.docs.map(ThisIsACustomPrefixQueryDocumentSnapshot._).toList(); + final docs = snapshot.docs + .map(ThisIsACustomPrefixQueryDocumentSnapshot._) + .toList(); final docChanges = snapshot.docChanges.map((change) { return _decodeDocumentChange( @@ -13016,18 +13221,14 @@ class ThisIsACustomPrefixQuerySnapshot extends FirestoreQuerySnapshot< ); }).toList(); - return ThisIsACustomPrefixQuerySnapshot._( - snapshot, - docs, - docChanges, - ); + return ThisIsACustomPrefixQuerySnapshot._(snapshot, docs, docChanges); } static FirestoreDocumentChange - _decodeDocumentChange( + _decodeDocumentChange( DocumentChange docChange, ThisIsACustomPrefixDocumentSnapshot Function(DocumentSnapshot doc) - decodeDoc, + decodeDoc, ) { return FirestoreDocumentChange( type: docChange.type, @@ -13044,14 +13245,14 @@ class ThisIsACustomPrefixQuerySnapshot extends FirestoreQuerySnapshot< @override final List> - docChanges; + docChanges; } class ThisIsACustomPrefixQueryDocumentSnapshot extends FirestoreQueryDocumentSnapshot implements ThisIsACustomPrefixDocumentSnapshot { ThisIsACustomPrefixQueryDocumentSnapshot._(this.snapshot) - : data = snapshot.data(); + : data = snapshot.data(); @override final QueryDocumentSnapshot snapshot; @@ -13072,9 +13273,8 @@ abstract class ExplicitPathCollectionReference implements ExplicitPathQuery, FirestoreCollectionReference { - factory ExplicitPathCollectionReference([ - FirebaseFirestore? firestore, - ]) = _$ExplicitPathCollectionReference; + factory ExplicitPathCollectionReference([FirebaseFirestore? firestore]) = + _$ExplicitPathCollectionReference; static ExplicitPath fromFirestore( DocumentSnapshot> snapshot, @@ -13107,7 +13307,9 @@ class _$ExplicitPathCollectionReference extends _$ExplicitPathQuery firestore ??= FirebaseFirestore.instance; return _$ExplicitPathCollectionReference._( - firestore.collection('root/doc/path').withConverter( + firestore + .collection('root/doc/path') + .withConverter( fromFirestore: ExplicitPathCollectionReference.fromFirestore, toFirestore: ExplicitPathCollectionReference.toFirestore, ), @@ -13130,9 +13332,7 @@ class _$ExplicitPathCollectionReference extends _$ExplicitPathQuery id == null || id.split('/').length == 1, 'The document ID cannot be from a different collection', ); - return ExplicitPathDocumentReference( - reference.doc(id), - ); + return ExplicitPathDocumentReference(reference.doc(id)); } @override @@ -13153,11 +13353,12 @@ class _$ExplicitPathCollectionReference extends _$ExplicitPathQuery int get hashCode => Object.hash(runtimeType, reference); } -abstract class ExplicitPathDocumentReference extends FirestoreDocumentReference< - ExplicitPath, ExplicitPathDocumentSnapshot> { +abstract class ExplicitPathDocumentReference + extends + FirestoreDocumentReference { factory ExplicitPathDocumentReference( - DocumentReference reference) = - _$ExplicitPathDocumentReference; + DocumentReference reference, + ) = _$ExplicitPathDocumentReference; DocumentReference get reference; @@ -13167,9 +13368,7 @@ abstract class ExplicitPathDocumentReference extends FirestoreDocumentReference< } late final ExplicitSubPathCollectionReference sub = - _$ExplicitSubPathCollectionReference( - reference, - ); + _$ExplicitSubPathCollectionReference(reference); @override Stream snapshots(); @@ -13226,10 +13425,7 @@ abstract class ExplicitPathDocumentReference extends FirestoreDocumentReference< /// document data. /// /// If no document exists yet, the update will fail. - Future update({ - num value, - FieldValue valueFieldValue, - }); + Future update({num value, FieldValue valueFieldValue}); /// Updates fields in the current document using the transaction API. /// @@ -13243,16 +13439,13 @@ abstract class ExplicitPathDocumentReference extends FirestoreDocumentReference< /// Updates fields in the current document using the batch API. /// /// The update will fail if applied to a document that does not exist. - void batchUpdate( - WriteBatch batch, { - num value, - FieldValue valueFieldValue, - }); + void batchUpdate(WriteBatch batch, {num value, FieldValue valueFieldValue}); } -class _$ExplicitPathDocumentReference extends FirestoreDocumentReference< - ExplicitPath, - ExplicitPathDocumentSnapshot> implements ExplicitPathDocumentReference { +class _$ExplicitPathDocumentReference + extends + FirestoreDocumentReference + implements ExplicitPathDocumentReference { _$ExplicitPathDocumentReference(this.reference); @override @@ -13264,9 +13457,7 @@ class _$ExplicitPathDocumentReference extends FirestoreDocumentReference< } late final ExplicitSubPathCollectionReference sub = - _$ExplicitSubPathCollectionReference( - reference, - ); + _$ExplicitSubPathCollectionReference(reference); @override Stream snapshots() { @@ -13349,8 +13540,10 @@ class _$ExplicitPathDocumentReference extends FirestoreDocumentReference< ); final json = { if (value != _sentinel) - _$ExplicitPathFieldMap['value']!: - _$ExplicitPathPerFieldToJson.value(value as num), + _$ExplicitPathFieldMap['value']!: _$ExplicitPathPerFieldToJson.value( + value as num, + ), + if (valueFieldValue != null) _$ExplicitPathFieldMap['value']!: valueFieldValue, }; @@ -13369,8 +13562,10 @@ class _$ExplicitPathDocumentReference extends FirestoreDocumentReference< ); final json = { if (value != _sentinel) - _$ExplicitPathFieldMap['value']!: - _$ExplicitPathPerFieldToJson.value(value as num), + _$ExplicitPathFieldMap['value']!: _$ExplicitPathPerFieldToJson.value( + value as num, + ), + if (valueFieldValue != null) _$ExplicitPathFieldMap['value']!: valueFieldValue, }; @@ -13389,8 +13584,10 @@ class _$ExplicitPathDocumentReference extends FirestoreDocumentReference< ); final json = { if (value != _sentinel) - _$ExplicitPathFieldMap['value']!: - _$ExplicitPathPerFieldToJson.value(value as num), + _$ExplicitPathFieldMap['value']!: _$ExplicitPathPerFieldToJson.value( + value as num, + ), + if (valueFieldValue != null) _$ExplicitPathFieldMap['value']!: valueFieldValue, }; @@ -13540,17 +13737,17 @@ class _$ExplicitPathQuery required Query $referenceWithoutCursor, $QueryCursor $queryCursor = const $QueryCursor(), }) : super( - $referenceWithoutCursor: $referenceWithoutCursor, - $queryCursor: $queryCursor, - ); + $referenceWithoutCursor: $referenceWithoutCursor, + $queryCursor: $queryCursor, + ); final CollectionReference _collection; @override Stream snapshots([SnapshotOptions? options]) { - return reference - .snapshots() - .map(ExplicitPathQuerySnapshot._fromQuerySnapshot); + return reference.snapshots().map( + ExplicitPathQuerySnapshot._fromQuerySnapshot, + ); } @override @@ -13607,7 +13804,8 @@ class _$ExplicitPathQuery arrayContainsAny: arrayContainsAny, whereIn: whereIn, whereNotIn: whereNotIn, - isNull: isNull ?? + isNull: + isNull ?? (isEqualTo == null ? false : null) ?? (isNotEqualTo == null ? true : null), ), @@ -13639,7 +13837,8 @@ class _$ExplicitPathQuery isGreaterThanOrEqualTo: isGreaterThanOrEqualTo, whereIn: whereIn, whereNotIn: whereNotIn, - isNull: isNull ?? + isNull: + isNull ?? (isEqualTo == null ? false : null) ?? (isNotEqualTo == null ? true : null), ), @@ -13682,9 +13881,11 @@ class _$ExplicitPathQuery ? _$ExplicitPathPerFieldToJson.value(isGreaterThanOrEqualTo as num) : null, whereIn: whereIn?.map((e) => _$ExplicitPathPerFieldToJson.value(e)), - whereNotIn: - whereNotIn?.map((e) => _$ExplicitPathPerFieldToJson.value(e)), - isNull: isNull ?? + whereNotIn: whereNotIn?.map( + (e) => _$ExplicitPathPerFieldToJson.value(e), + ), + isNull: + isNull ?? (isEqualTo == null ? false : null) ?? (isNotEqualTo == null ? true : null), ), @@ -13705,8 +13906,10 @@ class _$ExplicitPathQuery ExplicitPathDocumentSnapshot? endBeforeDocument, ExplicitPathDocumentSnapshot? startAfterDocument, }) { - final query = - $referenceWithoutCursor.orderBy(fieldPath, descending: descending); + final query = $referenceWithoutCursor.orderBy( + fieldPath, + descending: descending, + ); var queryCursor = $queryCursor; if (startAtDocument != null) { @@ -13778,8 +13981,10 @@ class _$ExplicitPathQuery ExplicitPathDocumentSnapshot? endBeforeDocument, ExplicitPathDocumentSnapshot? startAfterDocument, }) { - final query = $referenceWithoutCursor.orderBy(FieldPath.documentId, - descending: descending); + final query = $referenceWithoutCursor.orderBy( + FieldPath.documentId, + descending: descending, + ); var queryCursor = $queryCursor; if (startAtDocument != null) { @@ -13851,8 +14056,10 @@ class _$ExplicitPathQuery ExplicitPathDocumentSnapshot? endBeforeDocument, ExplicitPathDocumentSnapshot? startAfterDocument, }) { - final query = $referenceWithoutCursor - .orderBy(_$ExplicitPathFieldMap['value']!, descending: descending); + final query = $referenceWithoutCursor.orderBy( + _$ExplicitPathFieldMap['value']!, + descending: descending, + ); var queryCursor = $queryCursor; if (startAtDocument != null) { @@ -13884,7 +14091,7 @@ class _$ExplicitPathQuery queryCursor = queryCursor.copyWith( startAt: [ ...queryCursor.startAt, - _$ExplicitPathPerFieldToJson.value(startAt as num) + _$ExplicitPathPerFieldToJson.value(startAt as num), ], startAtDocumentSnapshot: null, ); @@ -13893,7 +14100,7 @@ class _$ExplicitPathQuery queryCursor = queryCursor.copyWith( startAfter: [ ...queryCursor.startAfter, - _$ExplicitPathPerFieldToJson.value(startAfter as num) + _$ExplicitPathPerFieldToJson.value(startAfter as num), ], startAfterDocumentSnapshot: null, ); @@ -13902,7 +14109,7 @@ class _$ExplicitPathQuery queryCursor = queryCursor.copyWith( endAt: [ ...queryCursor.endAt, - _$ExplicitPathPerFieldToJson.value(endAt as num) + _$ExplicitPathPerFieldToJson.value(endAt as num), ], endAtDocumentSnapshot: null, ); @@ -13911,7 +14118,7 @@ class _$ExplicitPathQuery queryCursor = queryCursor.copyWith( endBefore: [ ...queryCursor.endBefore, - _$ExplicitPathPerFieldToJson.value(endBefore as num) + _$ExplicitPathPerFieldToJson.value(endBefore as num), ], endBeforeDocumentSnapshot: null, ); @@ -13944,45 +14151,37 @@ class ExplicitPathDocumentSnapshot @override ExplicitPathDocumentReference get reference { - return ExplicitPathDocumentReference( - snapshot.reference, - ); + return ExplicitPathDocumentReference(snapshot.reference); } @override final ExplicitPath? data; } -class ExplicitPathQuerySnapshot extends FirestoreQuerySnapshot { - ExplicitPathQuerySnapshot._( - this.snapshot, - this.docs, - this.docChanges, - ); +class ExplicitPathQuerySnapshot + extends + FirestoreQuerySnapshot< + ExplicitPath, + ExplicitPathQueryDocumentSnapshot + > { + ExplicitPathQuerySnapshot._(this.snapshot, this.docs, this.docChanges); factory ExplicitPathQuerySnapshot._fromQuerySnapshot( QuerySnapshot snapshot, ) { - final docs = - snapshot.docs.map(ExplicitPathQueryDocumentSnapshot._).toList(); + final docs = snapshot.docs + .map(ExplicitPathQueryDocumentSnapshot._) + .toList(); final docChanges = snapshot.docChanges.map((change) { - return _decodeDocumentChange( - change, - ExplicitPathDocumentSnapshot._, - ); + return _decodeDocumentChange(change, ExplicitPathDocumentSnapshot._); }).toList(); - return ExplicitPathQuerySnapshot._( - snapshot, - docs, - docChanges, - ); + return ExplicitPathQuerySnapshot._(snapshot, docs, docChanges); } static FirestoreDocumentChange - _decodeDocumentChange( + _decodeDocumentChange( DocumentChange docChange, ExplicitPathDocumentSnapshot Function(DocumentSnapshot doc) decodeDoc, ) { @@ -14026,8 +14225,10 @@ class ExplicitPathQueryDocumentSnapshot abstract class ExplicitSubPathCollectionReference implements ExplicitSubPathQuery, - FirestoreCollectionReference { + FirestoreCollectionReference< + ExplicitSubPath, + ExplicitSubPathQuerySnapshot + > { factory ExplicitSubPathCollectionReference( DocumentReference parent, ) = _$ExplicitSubPathCollectionReference; @@ -14067,7 +14268,9 @@ class _$ExplicitSubPathCollectionReference extends _$ExplicitSubPathQuery ) { return _$ExplicitSubPathCollectionReference._( ExplicitPathDocumentReference(parent), - parent.collection('sub').withConverter( + parent + .collection('sub') + .withConverter( fromFirestore: ExplicitSubPathCollectionReference.fromFirestore, toFirestore: ExplicitSubPathCollectionReference.toFirestore, ), @@ -14094,9 +14297,7 @@ class _$ExplicitSubPathCollectionReference extends _$ExplicitSubPathQuery id == null || id.split('/').length == 1, 'The document ID cannot be from a different collection', ); - return ExplicitSubPathDocumentReference( - reference.doc(id), - ); + return ExplicitSubPathDocumentReference(reference.doc(id)); } @override @@ -14118,11 +14319,14 @@ class _$ExplicitSubPathCollectionReference extends _$ExplicitSubPathQuery } abstract class ExplicitSubPathDocumentReference - extends FirestoreDocumentReference { + extends + FirestoreDocumentReference< + ExplicitSubPath, + ExplicitSubPathDocumentSnapshot + > { factory ExplicitSubPathDocumentReference( - DocumentReference reference) = - _$ExplicitSubPathDocumentReference; + DocumentReference reference, + ) = _$ExplicitSubPathDocumentReference; DocumentReference get reference; @@ -14191,10 +14395,7 @@ abstract class ExplicitSubPathDocumentReference /// document data. /// /// If no document exists yet, the update will fail. - Future update({ - num value, - FieldValue valueFieldValue, - }); + Future update({num value, FieldValue valueFieldValue}); /// Updates fields in the current document using the transaction API. /// @@ -14208,15 +14409,15 @@ abstract class ExplicitSubPathDocumentReference /// Updates fields in the current document using the batch API. /// /// The update will fail if applied to a document that does not exist. - void batchUpdate( - WriteBatch batch, { - num value, - FieldValue valueFieldValue, - }); + void batchUpdate(WriteBatch batch, {num value, FieldValue valueFieldValue}); } -class _$ExplicitSubPathDocumentReference extends FirestoreDocumentReference< - ExplicitSubPath, ExplicitSubPathDocumentSnapshot> +class _$ExplicitSubPathDocumentReference + extends + FirestoreDocumentReference< + ExplicitSubPath, + ExplicitSubPathDocumentSnapshot + > implements ExplicitSubPathDocumentReference { _$ExplicitSubPathDocumentReference(this.reference); @@ -14245,7 +14446,8 @@ class _$ExplicitSubPathDocumentReference extends FirestoreDocumentReference< @override Future transactionGet( - Transaction transaction) { + Transaction transaction, + ) { return transaction.get(reference).then(ExplicitSubPathDocumentSnapshot._); } @@ -14315,8 +14517,9 @@ class _$ExplicitSubPathDocumentReference extends FirestoreDocumentReference< ); final json = { if (value != _sentinel) - _$ExplicitSubPathFieldMap['value']!: - _$ExplicitSubPathPerFieldToJson.value(value as num), + _$ExplicitSubPathFieldMap['value']!: _$ExplicitSubPathPerFieldToJson + .value(value as num), + if (valueFieldValue != null) _$ExplicitSubPathFieldMap['value']!: valueFieldValue, }; @@ -14335,8 +14538,9 @@ class _$ExplicitSubPathDocumentReference extends FirestoreDocumentReference< ); final json = { if (value != _sentinel) - _$ExplicitSubPathFieldMap['value']!: - _$ExplicitSubPathPerFieldToJson.value(value as num), + _$ExplicitSubPathFieldMap['value']!: _$ExplicitSubPathPerFieldToJson + .value(value as num), + if (valueFieldValue != null) _$ExplicitSubPathFieldMap['value']!: valueFieldValue, }; @@ -14355,8 +14559,9 @@ class _$ExplicitSubPathDocumentReference extends FirestoreDocumentReference< ); final json = { if (value != _sentinel) - _$ExplicitSubPathFieldMap['value']!: - _$ExplicitSubPathPerFieldToJson.value(value as num), + _$ExplicitSubPathFieldMap['value']!: _$ExplicitSubPathPerFieldToJson + .value(value as num), + if (valueFieldValue != null) _$ExplicitSubPathFieldMap['value']!: valueFieldValue, }; @@ -14506,17 +14711,17 @@ class _$ExplicitSubPathQuery required Query $referenceWithoutCursor, $QueryCursor $queryCursor = const $QueryCursor(), }) : super( - $referenceWithoutCursor: $referenceWithoutCursor, - $queryCursor: $queryCursor, - ); + $referenceWithoutCursor: $referenceWithoutCursor, + $queryCursor: $queryCursor, + ); final CollectionReference _collection; @override Stream snapshots([SnapshotOptions? options]) { - return reference - .snapshots() - .map(ExplicitSubPathQuerySnapshot._fromQuerySnapshot); + return reference.snapshots().map( + ExplicitSubPathQuerySnapshot._fromQuerySnapshot, + ); } @override @@ -14573,7 +14778,8 @@ class _$ExplicitSubPathQuery arrayContainsAny: arrayContainsAny, whereIn: whereIn, whereNotIn: whereNotIn, - isNull: isNull ?? + isNull: + isNull ?? (isEqualTo == null ? false : null) ?? (isNotEqualTo == null ? true : null), ), @@ -14605,7 +14811,8 @@ class _$ExplicitSubPathQuery isGreaterThanOrEqualTo: isGreaterThanOrEqualTo, whereIn: whereIn, whereNotIn: whereNotIn, - isNull: isNull ?? + isNull: + isNull ?? (isEqualTo == null ? false : null) ?? (isNotEqualTo == null ? true : null), ), @@ -14645,13 +14852,16 @@ class _$ExplicitSubPathQuery ? _$ExplicitSubPathPerFieldToJson.value(isGreaterThan as num) : null, isGreaterThanOrEqualTo: isGreaterThanOrEqualTo != null - ? _$ExplicitSubPathPerFieldToJson - .value(isGreaterThanOrEqualTo as num) + ? _$ExplicitSubPathPerFieldToJson.value( + isGreaterThanOrEqualTo as num, + ) : null, whereIn: whereIn?.map((e) => _$ExplicitSubPathPerFieldToJson.value(e)), - whereNotIn: - whereNotIn?.map((e) => _$ExplicitSubPathPerFieldToJson.value(e)), - isNull: isNull ?? + whereNotIn: whereNotIn?.map( + (e) => _$ExplicitSubPathPerFieldToJson.value(e), + ), + isNull: + isNull ?? (isEqualTo == null ? false : null) ?? (isNotEqualTo == null ? true : null), ), @@ -14672,8 +14882,10 @@ class _$ExplicitSubPathQuery ExplicitSubPathDocumentSnapshot? endBeforeDocument, ExplicitSubPathDocumentSnapshot? startAfterDocument, }) { - final query = - $referenceWithoutCursor.orderBy(fieldPath, descending: descending); + final query = $referenceWithoutCursor.orderBy( + fieldPath, + descending: descending, + ); var queryCursor = $queryCursor; if (startAtDocument != null) { @@ -14745,8 +14957,10 @@ class _$ExplicitSubPathQuery ExplicitSubPathDocumentSnapshot? endBeforeDocument, ExplicitSubPathDocumentSnapshot? startAfterDocument, }) { - final query = $referenceWithoutCursor.orderBy(FieldPath.documentId, - descending: descending); + final query = $referenceWithoutCursor.orderBy( + FieldPath.documentId, + descending: descending, + ); var queryCursor = $queryCursor; if (startAtDocument != null) { @@ -14818,8 +15032,10 @@ class _$ExplicitSubPathQuery ExplicitSubPathDocumentSnapshot? endBeforeDocument, ExplicitSubPathDocumentSnapshot? startAfterDocument, }) { - final query = $referenceWithoutCursor - .orderBy(_$ExplicitSubPathFieldMap['value']!, descending: descending); + final query = $referenceWithoutCursor.orderBy( + _$ExplicitSubPathFieldMap['value']!, + descending: descending, + ); var queryCursor = $queryCursor; if (startAtDocument != null) { @@ -14851,7 +15067,7 @@ class _$ExplicitSubPathQuery queryCursor = queryCursor.copyWith( startAt: [ ...queryCursor.startAt, - _$ExplicitSubPathPerFieldToJson.value(startAt as num) + _$ExplicitSubPathPerFieldToJson.value(startAt as num), ], startAtDocumentSnapshot: null, ); @@ -14860,7 +15076,7 @@ class _$ExplicitSubPathQuery queryCursor = queryCursor.copyWith( startAfter: [ ...queryCursor.startAfter, - _$ExplicitSubPathPerFieldToJson.value(startAfter as num) + _$ExplicitSubPathPerFieldToJson.value(startAfter as num), ], startAfterDocumentSnapshot: null, ); @@ -14869,7 +15085,7 @@ class _$ExplicitSubPathQuery queryCursor = queryCursor.copyWith( endAt: [ ...queryCursor.endAt, - _$ExplicitSubPathPerFieldToJson.value(endAt as num) + _$ExplicitSubPathPerFieldToJson.value(endAt as num), ], endAtDocumentSnapshot: null, ); @@ -14878,7 +15094,7 @@ class _$ExplicitSubPathQuery queryCursor = queryCursor.copyWith( endBefore: [ ...queryCursor.endBefore, - _$ExplicitSubPathPerFieldToJson.value(endBefore as num) + _$ExplicitSubPathPerFieldToJson.value(endBefore as num), ], endBeforeDocumentSnapshot: null, ); @@ -14911,45 +15127,37 @@ class ExplicitSubPathDocumentSnapshot @override ExplicitSubPathDocumentReference get reference { - return ExplicitSubPathDocumentReference( - snapshot.reference, - ); + return ExplicitSubPathDocumentReference(snapshot.reference); } @override final ExplicitSubPath? data; } -class ExplicitSubPathQuerySnapshot extends FirestoreQuerySnapshot< - ExplicitSubPath, ExplicitSubPathQueryDocumentSnapshot> { - ExplicitSubPathQuerySnapshot._( - this.snapshot, - this.docs, - this.docChanges, - ); +class ExplicitSubPathQuerySnapshot + extends + FirestoreQuerySnapshot< + ExplicitSubPath, + ExplicitSubPathQueryDocumentSnapshot + > { + ExplicitSubPathQuerySnapshot._(this.snapshot, this.docs, this.docChanges); factory ExplicitSubPathQuerySnapshot._fromQuerySnapshot( QuerySnapshot snapshot, ) { - final docs = - snapshot.docs.map(ExplicitSubPathQueryDocumentSnapshot._).toList(); + final docs = snapshot.docs + .map(ExplicitSubPathQueryDocumentSnapshot._) + .toList(); final docChanges = snapshot.docChanges.map((change) { - return _decodeDocumentChange( - change, - ExplicitSubPathDocumentSnapshot._, - ); + return _decodeDocumentChange(change, ExplicitSubPathDocumentSnapshot._); }).toList(); - return ExplicitSubPathQuerySnapshot._( - snapshot, - docs, - docChanges, - ); + return ExplicitSubPathQuerySnapshot._(snapshot, docs, docChanges); } static FirestoreDocumentChange - _decodeDocumentChange( + _decodeDocumentChange( DocumentChange docChange, ExplicitSubPathDocumentSnapshot Function(DocumentSnapshot doc) decodeDoc, ) { @@ -14968,14 +15176,14 @@ class ExplicitSubPathQuerySnapshot extends FirestoreQuerySnapshot< @override final List> - docChanges; + docChanges; } class ExplicitSubPathQueryDocumentSnapshot extends FirestoreQueryDocumentSnapshot implements ExplicitSubPathDocumentSnapshot { ExplicitSubPathQueryDocumentSnapshot._(this.snapshot) - : data = snapshot.data(); + : data = snapshot.data(); @override final QueryDocumentSnapshot snapshot; @@ -14996,9 +15204,8 @@ abstract class SubClassCollectionReference implements SubClassQuery, FirestoreCollectionReference { - factory SubClassCollectionReference([ - FirebaseFirestore? firestore, - ]) = _$SubClassCollectionReference; + factory SubClassCollectionReference([FirebaseFirestore? firestore]) = + _$SubClassCollectionReference; static SubClass fromFirestore( DocumentSnapshot> snapshot, @@ -15007,10 +15214,7 @@ abstract class SubClassCollectionReference return SubClass.fromJson(snapshot.data()!); } - static Map toFirestore( - SubClass value, - SetOptions? options, - ) { + static Map toFirestore(SubClass value, SetOptions? options) { return value.toJson(); } @@ -15031,16 +15235,17 @@ class _$SubClassCollectionReference extends _$SubClassQuery firestore ??= FirebaseFirestore.instance; return _$SubClassCollectionReference._( - firestore.collection('root').withConverter( + firestore + .collection('root') + .withConverter( fromFirestore: SubClassCollectionReference.fromFirestore, toFirestore: SubClassCollectionReference.toFirestore, ), ); } - _$SubClassCollectionReference._( - CollectionReference reference, - ) : super(reference, $referenceWithoutCursor: reference); + _$SubClassCollectionReference._(CollectionReference reference) + : super(reference, $referenceWithoutCursor: reference); String get path => reference.path; @@ -15054,9 +15259,7 @@ class _$SubClassCollectionReference extends _$SubClassQuery id == null || id.split('/').length == 1, 'The document ID cannot be from a different collection', ); - return SubClassDocumentReference( - reference.doc(id), - ); + return SubClassDocumentReference(reference.doc(id)); } @override @@ -15260,8 +15463,9 @@ class _$SubClassDocumentReference ); final json = { if (instanceGetter != _sentinel) - _$SubClassFieldMap['instanceGetter']!: - _$SubClassPerFieldToJson.instanceGetter(instanceGetter as int), + _$SubClassFieldMap['instanceGetter']!: _$SubClassPerFieldToJson + .instanceGetter(instanceGetter as int), + if (instanceGetterFieldValue != null) _$SubClassFieldMap['instanceGetter']!: instanceGetterFieldValue, }; @@ -15280,8 +15484,9 @@ class _$SubClassDocumentReference ); final json = { if (instanceGetter != _sentinel) - _$SubClassFieldMap['instanceGetter']!: - _$SubClassPerFieldToJson.instanceGetter(instanceGetter as int), + _$SubClassFieldMap['instanceGetter']!: _$SubClassPerFieldToJson + .instanceGetter(instanceGetter as int), + if (instanceGetterFieldValue != null) _$SubClassFieldMap['instanceGetter']!: instanceGetterFieldValue, }; @@ -15300,8 +15505,9 @@ class _$SubClassDocumentReference ); final json = { if (instanceGetter != _sentinel) - _$SubClassFieldMap['instanceGetter']!: - _$SubClassPerFieldToJson.instanceGetter(instanceGetter as int), + _$SubClassFieldMap['instanceGetter']!: _$SubClassPerFieldToJson + .instanceGetter(instanceGetter as int), + if (instanceGetterFieldValue != null) _$SubClassFieldMap['instanceGetter']!: instanceGetterFieldValue, }; @@ -15450,9 +15656,9 @@ class _$SubClassQuery extends QueryReference required Query $referenceWithoutCursor, $QueryCursor $queryCursor = const $QueryCursor(), }) : super( - $referenceWithoutCursor: $referenceWithoutCursor, - $queryCursor: $queryCursor, - ); + $referenceWithoutCursor: $referenceWithoutCursor, + $queryCursor: $queryCursor, + ); final CollectionReference _collection; @@ -15515,7 +15721,8 @@ class _$SubClassQuery extends QueryReference arrayContainsAny: arrayContainsAny, whereIn: whereIn, whereNotIn: whereNotIn, - isNull: isNull ?? + isNull: + isNull ?? (isEqualTo == null ? false : null) ?? (isNotEqualTo == null ? true : null), ), @@ -15547,7 +15754,8 @@ class _$SubClassQuery extends QueryReference isGreaterThanOrEqualTo: isGreaterThanOrEqualTo, whereIn: whereIn, whereNotIn: whereNotIn, - isNull: isNull ?? + isNull: + isNull ?? (isEqualTo == null ? false : null) ?? (isNotEqualTo == null ? true : null), ), @@ -15581,21 +15789,26 @@ class _$SubClassQuery extends QueryReference ? _$SubClassPerFieldToJson.instanceGetter(isLessThan as int) : null, isLessThanOrEqualTo: isLessThanOrEqualTo != null - ? _$SubClassPerFieldToJson - .instanceGetter(isLessThanOrEqualTo as int) + ? _$SubClassPerFieldToJson.instanceGetter( + isLessThanOrEqualTo as int, + ) : null, isGreaterThan: isGreaterThan != null ? _$SubClassPerFieldToJson.instanceGetter(isGreaterThan as int) : null, isGreaterThanOrEqualTo: isGreaterThanOrEqualTo != null - ? _$SubClassPerFieldToJson - .instanceGetter(isGreaterThanOrEqualTo as int) - : null, - whereIn: - whereIn?.map((e) => _$SubClassPerFieldToJson.instanceGetter(e)), - whereNotIn: - whereNotIn?.map((e) => _$SubClassPerFieldToJson.instanceGetter(e)), - isNull: isNull ?? + ? _$SubClassPerFieldToJson.instanceGetter( + isGreaterThanOrEqualTo as int, + ) + : null, + whereIn: whereIn?.map( + (e) => _$SubClassPerFieldToJson.instanceGetter(e), + ), + whereNotIn: whereNotIn?.map( + (e) => _$SubClassPerFieldToJson.instanceGetter(e), + ), + isNull: + isNull ?? (isEqualTo == null ? false : null) ?? (isNotEqualTo == null ? true : null), ), @@ -15616,8 +15829,10 @@ class _$SubClassQuery extends QueryReference SubClassDocumentSnapshot? endBeforeDocument, SubClassDocumentSnapshot? startAfterDocument, }) { - final query = - $referenceWithoutCursor.orderBy(fieldPath, descending: descending); + final query = $referenceWithoutCursor.orderBy( + fieldPath, + descending: descending, + ); var queryCursor = $queryCursor; if (startAtDocument != null) { @@ -15689,8 +15904,10 @@ class _$SubClassQuery extends QueryReference SubClassDocumentSnapshot? endBeforeDocument, SubClassDocumentSnapshot? startAfterDocument, }) { - final query = $referenceWithoutCursor.orderBy(FieldPath.documentId, - descending: descending); + final query = $referenceWithoutCursor.orderBy( + FieldPath.documentId, + descending: descending, + ); var queryCursor = $queryCursor; if (startAtDocument != null) { @@ -15762,8 +15979,10 @@ class _$SubClassQuery extends QueryReference SubClassDocumentSnapshot? endBeforeDocument, SubClassDocumentSnapshot? startAfterDocument, }) { - final query = $referenceWithoutCursor - .orderBy(_$SubClassFieldMap['instanceGetter']!, descending: descending); + final query = $referenceWithoutCursor.orderBy( + _$SubClassFieldMap['instanceGetter']!, + descending: descending, + ); var queryCursor = $queryCursor; if (startAtDocument != null) { @@ -15795,7 +16014,7 @@ class _$SubClassQuery extends QueryReference queryCursor = queryCursor.copyWith( startAt: [ ...queryCursor.startAt, - _$SubClassPerFieldToJson.instanceGetter(startAt as int) + _$SubClassPerFieldToJson.instanceGetter(startAt as int), ], startAtDocumentSnapshot: null, ); @@ -15804,7 +16023,7 @@ class _$SubClassQuery extends QueryReference queryCursor = queryCursor.copyWith( startAfter: [ ...queryCursor.startAfter, - _$SubClassPerFieldToJson.instanceGetter(startAfter as int) + _$SubClassPerFieldToJson.instanceGetter(startAfter as int), ], startAfterDocumentSnapshot: null, ); @@ -15813,7 +16032,7 @@ class _$SubClassQuery extends QueryReference queryCursor = queryCursor.copyWith( endAt: [ ...queryCursor.endAt, - _$SubClassPerFieldToJson.instanceGetter(endAt as int) + _$SubClassPerFieldToJson.instanceGetter(endAt as int), ], endAtDocumentSnapshot: null, ); @@ -15822,7 +16041,7 @@ class _$SubClassQuery extends QueryReference queryCursor = queryCursor.copyWith( endBefore: [ ...queryCursor.endBefore, - _$SubClassPerFieldToJson.instanceGetter(endBefore as int) + _$SubClassPerFieldToJson.instanceGetter(endBefore as int), ], endBeforeDocumentSnapshot: null, ); @@ -15854,9 +16073,7 @@ class SubClassDocumentSnapshot extends FirestoreDocumentSnapshot { @override SubClassDocumentReference get reference { - return SubClassDocumentReference( - snapshot.reference, - ); + return SubClassDocumentReference(snapshot.reference); } @override @@ -15865,11 +16082,7 @@ class SubClassDocumentSnapshot extends FirestoreDocumentSnapshot { class SubClassQuerySnapshot extends FirestoreQuerySnapshot { - SubClassQuerySnapshot._( - this.snapshot, - this.docs, - this.docChanges, - ); + SubClassQuerySnapshot._(this.snapshot, this.docs, this.docChanges); factory SubClassQuerySnapshot._fromQuerySnapshot( QuerySnapshot snapshot, @@ -15877,21 +16090,14 @@ class SubClassQuerySnapshot final docs = snapshot.docs.map(SubClassQueryDocumentSnapshot._).toList(); final docChanges = snapshot.docChanges.map((change) { - return _decodeDocumentChange( - change, - SubClassDocumentSnapshot._, - ); + return _decodeDocumentChange(change, SubClassDocumentSnapshot._); }).toList(); - return SubClassQuerySnapshot._( - snapshot, - docs, - docChanges, - ); + return SubClassQuerySnapshot._(snapshot, docs, docChanges); } static FirestoreDocumentChange - _decodeDocumentChange( + _decodeDocumentChange( DocumentChange docChange, SubClassDocumentSnapshot Function(DocumentSnapshot doc) decodeDoc, ) { @@ -15945,9 +16151,7 @@ void _$assertMinValidation(MinValidation instance) { // ************************************************************************** IgnoredGetter _$IgnoredGetterFromJson(Map json) => - IgnoredGetter( - (json['value'] as num).toInt(), - ); + IgnoredGetter((json['value'] as num).toInt()); const _$IgnoredGetterFieldMap = { 'value': 'value', @@ -15963,18 +16167,12 @@ abstract class _$IgnoredGetterPerFieldToJson { } Map _$IgnoredGetterToJson(IgnoredGetter instance) => - { - 'value': instance.value, - 'count3': instance.count3, - }; + {'value': instance.value, 'count3': instance.count3}; -Model _$ModelFromJson(Map json) => Model( - json['value'] as String, - ); +Model _$ModelFromJson(Map json) => + Model(json['value'] as String); -const _$ModelFieldMap = { - 'value': 'value', -}; +const _$ModelFieldMap = {'value': 'value'}; // ignore: unused_element abstract class _$ModelPerFieldToJson { @@ -15983,38 +16181,39 @@ abstract class _$ModelPerFieldToJson { } Map _$ModelToJson(Model instance) => { - 'value': instance.value, - }; + 'value': instance.value, +}; Nested _$NestedFromJson(Map json) => Nested( - value: json['value'] == null - ? null - : Nested.fromJson(json['value'] as Map), - simple: (json['simple'] as num?)?.toInt(), - valueList: (json['valueList'] as List?) - ?.map((e) => Nested.fromJson(e as Map)) - .toList(), - boolList: - (json['boolList'] as List?)?.map((e) => e as bool).toList(), - stringList: (json['stringList'] as List?) - ?.map((e) => e as String) - .toList(), - numList: - (json['numList'] as List?)?.map((e) => e as num).toList(), - objectList: json['objectList'] as List?, - dynamicList: json['dynamicList'] as List?, - boolSet: - (json['boolSet'] as List?)?.map((e) => e as bool).toSet(), - enumValue: $enumDecode(_$TestEnumEnumMap, json['enumValue']), - nullableEnumValue: - $enumDecodeNullable(_$TestEnumEnumMap, json['nullableEnumValue']), - enumList: (json['enumList'] as List) - .map((e) => $enumDecode(_$TestEnumEnumMap, e)) - .toList(), - nullableEnumList: (json['nullableEnumList'] as List?) - ?.map((e) => $enumDecode(_$TestEnumEnumMap, e)) - .toList(), - ); + value: json['value'] == null + ? null + : Nested.fromJson(json['value'] as Map), + simple: (json['simple'] as num?)?.toInt(), + valueList: (json['valueList'] as List?) + ?.map((e) => Nested.fromJson(e as Map)) + .toList(), + boolList: (json['boolList'] as List?) + ?.map((e) => e as bool) + .toList(), + stringList: (json['stringList'] as List?) + ?.map((e) => e as String) + .toList(), + numList: (json['numList'] as List?)?.map((e) => e as num).toList(), + objectList: json['objectList'] as List?, + dynamicList: json['dynamicList'] as List?, + boolSet: (json['boolSet'] as List?)?.map((e) => e as bool).toSet(), + enumValue: $enumDecode(_$TestEnumEnumMap, json['enumValue']), + nullableEnumValue: $enumDecodeNullable( + _$TestEnumEnumMap, + json['nullableEnumValue'], + ), + enumList: (json['enumList'] as List) + .map((e) => $enumDecode(_$TestEnumEnumMap, e)) + .toList(), + nullableEnumList: (json['nullableEnumList'] as List?) + ?.map((e) => $enumDecode(_$TestEnumEnumMap, e)) + .toList(), +); const _$NestedFieldMap = { 'value': 'value', @@ -16066,21 +16265,22 @@ abstract class _$NestedPerFieldToJson { } Map _$NestedToJson(Nested instance) => { - 'value': instance.value, - 'simple': instance.simple, - 'valueList': instance.valueList, - 'boolList': instance.boolList, - 'stringList': instance.stringList, - 'numList': instance.numList, - 'objectList': instance.objectList, - 'dynamicList': instance.dynamicList, - 'boolSet': instance.boolSet?.toList(), - 'enumValue': _$TestEnumEnumMap[instance.enumValue]!, - 'nullableEnumValue': _$TestEnumEnumMap[instance.nullableEnumValue], - 'enumList': instance.enumList.map((e) => _$TestEnumEnumMap[e]!).toList(), - 'nullableEnumList': - instance.nullableEnumList?.map((e) => _$TestEnumEnumMap[e]!).toList(), - }; + 'value': instance.value, + 'simple': instance.simple, + 'valueList': instance.valueList, + 'boolList': instance.boolList, + 'stringList': instance.stringList, + 'numList': instance.numList, + 'objectList': instance.objectList, + 'dynamicList': instance.dynamicList, + 'boolSet': instance.boolSet?.toList(), + 'enumValue': _$TestEnumEnumMap[instance.enumValue]!, + 'nullableEnumValue': _$TestEnumEnumMap[instance.nullableEnumValue], + 'enumList': instance.enumList.map((e) => _$TestEnumEnumMap[e]!).toList(), + 'nullableEnumList': instance.nullableEnumList + ?.map((e) => _$TestEnumEnumMap[e]!) + .toList(), +}; const _$TestEnumEnumMap = { TestEnum.one: 'one', @@ -16128,10 +16328,8 @@ Map _$MinValidationToJson(MinValidation instance) => 'numNbr': instance.numNbr, }; -Root _$RootFromJson(Map json) => Root( - json['nonNullable'] as String, - (json['nullable'] as num?)?.toInt(), - ); +Root _$RootFromJson(Map json) => + Root(json['nonNullable'] as String, (json['nullable'] as num?)?.toInt()); const _$RootFieldMap = { 'nonNullable': 'nonNullable', @@ -16147,17 +16345,14 @@ abstract class _$RootPerFieldToJson { } Map _$RootToJson(Root instance) => { - 'nonNullable': instance.nonNullable, - 'nullable': instance.nullable, - }; + 'nonNullable': instance.nonNullable, + 'nullable': instance.nullable, +}; -OptionalJson _$OptionalJsonFromJson(Map json) => OptionalJson( - (json['value'] as num).toInt(), - ); +OptionalJson _$OptionalJsonFromJson(Map json) => + OptionalJson((json['value'] as num).toInt()); -const _$OptionalJsonFieldMap = { - 'value': 'value', -}; +const _$OptionalJsonFieldMap = {'value': 'value'}; // ignore: unused_element abstract class _$OptionalJsonPerFieldToJson { @@ -16166,17 +16361,12 @@ abstract class _$OptionalJsonPerFieldToJson { } Map _$OptionalJsonToJson(OptionalJson instance) => - { - 'value': instance.value, - }; + {'value': instance.value}; -MixedJson _$MixedJsonFromJson(Map json) => MixedJson( - (json['value'] as num).toInt(), - ); +MixedJson _$MixedJsonFromJson(Map json) => + MixedJson((json['value'] as num).toInt()); -const _$MixedJsonFieldMap = { - 'value': 'value', -}; +const _$MixedJsonFieldMap = {'value': 'value'}; // ignore: unused_element abstract class _$MixedJsonPerFieldToJson { @@ -16185,13 +16375,11 @@ abstract class _$MixedJsonPerFieldToJson { } Map _$MixedJsonToJson(MixedJson instance) => { - 'value': instance.value, - }; + 'value': instance.value, +}; -Sub _$SubFromJson(Map json) => Sub( - json['nonNullable'] as String, - (json['nullable'] as num?)?.toInt(), - ); +Sub _$SubFromJson(Map json) => + Sub(json['nonNullable'] as String, (json['nullable'] as num?)?.toInt()); const _$SubFieldMap = { 'nonNullable': 'nonNullable', @@ -16207,18 +16395,14 @@ abstract class _$SubPerFieldToJson { } Map _$SubToJson(Sub instance) => { - 'nonNullable': instance.nonNullable, - 'nullable': instance.nullable, - }; + 'nonNullable': instance.nonNullable, + 'nullable': instance.nullable, +}; CustomSubName _$CustomSubNameFromJson(Map json) => - CustomSubName( - json['value'] as num, - ); + CustomSubName(json['value'] as num); -const _$CustomSubNameFieldMap = { - 'value': 'value', -}; +const _$CustomSubNameFieldMap = {'value': 'value'}; // ignore: unused_element abstract class _$CustomSubNamePerFieldToJson { @@ -16227,17 +16411,12 @@ abstract class _$CustomSubNamePerFieldToJson { } Map _$CustomSubNameToJson(CustomSubName instance) => - { - 'value': instance.value, - }; + {'value': instance.value}; -AsCamelCase _$AsCamelCaseFromJson(Map json) => AsCamelCase( - json['value'] as num, - ); +AsCamelCase _$AsCamelCaseFromJson(Map json) => + AsCamelCase(json['value'] as num); -const _$AsCamelCaseFieldMap = { - 'value': 'value', -}; +const _$AsCamelCaseFieldMap = {'value': 'value'}; // ignore: unused_element abstract class _$AsCamelCasePerFieldToJson { @@ -16246,18 +16425,12 @@ abstract class _$AsCamelCasePerFieldToJson { } Map _$AsCamelCaseToJson(AsCamelCase instance) => - { - 'value': instance.value, - }; + {'value': instance.value}; CustomClassPrefix _$CustomClassPrefixFromJson(Map json) => - CustomClassPrefix( - json['value'] as num, - ); + CustomClassPrefix(json['value'] as num); -const _$CustomClassPrefixFieldMap = { - 'value': 'value', -}; +const _$CustomClassPrefixFieldMap = {'value': 'value'}; // ignore: unused_element abstract class _$CustomClassPrefixPerFieldToJson { @@ -16266,17 +16439,12 @@ abstract class _$CustomClassPrefixPerFieldToJson { } Map _$CustomClassPrefixToJson(CustomClassPrefix instance) => - { - 'value': instance.value, - }; + {'value': instance.value}; -ExplicitPath _$ExplicitPathFromJson(Map json) => ExplicitPath( - json['value'] as num, - ); +ExplicitPath _$ExplicitPathFromJson(Map json) => + ExplicitPath(json['value'] as num); -const _$ExplicitPathFieldMap = { - 'value': 'value', -}; +const _$ExplicitPathFieldMap = {'value': 'value'}; // ignore: unused_element abstract class _$ExplicitPathPerFieldToJson { @@ -16285,18 +16453,12 @@ abstract class _$ExplicitPathPerFieldToJson { } Map _$ExplicitPathToJson(ExplicitPath instance) => - { - 'value': instance.value, - }; + {'value': instance.value}; ExplicitSubPath _$ExplicitSubPathFromJson(Map json) => - ExplicitSubPath( - json['value'] as num, - ); + ExplicitSubPath(json['value'] as num); -const _$ExplicitSubPathFieldMap = { - 'value': 'value', -}; +const _$ExplicitSubPathFieldMap = {'value': 'value'}; // ignore: unused_element abstract class _$ExplicitSubPathPerFieldToJson { @@ -16305,17 +16467,12 @@ abstract class _$ExplicitSubPathPerFieldToJson { } Map _$ExplicitSubPathToJson(ExplicitSubPath instance) => - { - 'value': instance.value, - }; + {'value': instance.value}; -SubClass _$SubClassFromJson(Map json) => SubClass( - (json['instanceGetter'] as num).toInt(), - ); +SubClass _$SubClassFromJson(Map json) => + SubClass((json['instanceGetter'] as num).toInt()); -const _$SubClassFieldMap = { - 'instanceGetter': 'instanceGetter', -}; +const _$SubClassFieldMap = {'instanceGetter': 'instanceGetter'}; // ignore: unused_element abstract class _$SubClassPerFieldToJson { @@ -16324,5 +16481,5 @@ abstract class _$SubClassPerFieldToJson { } Map _$SubClassToJson(SubClass instance) => { - 'instanceGetter': instance.instanceGetter, - }; + 'instanceGetter': instance.instanceGetter, +}; diff --git a/packages/cloud_firestore_odm_generator/cloud_firestore_odm_generator_integration_test/pubspec.yaml b/packages/cloud_firestore_odm_generator/cloud_firestore_odm_generator_integration_test/pubspec.yaml index c360b38..4db0592 100644 --- a/packages/cloud_firestore_odm_generator/cloud_firestore_odm_generator_integration_test/pubspec.yaml +++ b/packages/cloud_firestore_odm_generator/cloud_firestore_odm_generator_integration_test/pubspec.yaml @@ -2,27 +2,27 @@ name: cloud_firestore_odm_generator_integration_test publish_to: none environment: - sdk: ">=3.0.0 <4.0.0" + sdk: ">=3.8.0 <4.0.0" dependencies: cloud_firestore: ^6.0.0 cloud_firestore_odm: ^1.2.0 flutter: sdk: flutter - freezed_annotation: ^3.0.0 + freezed_annotation: ^3.1.0 json_annotation: ^4.9.0 meta: ^1.12.0 dev_dependencies: - build_runner: ^2.4.8 + build_runner: ^2.7.0 cloud_firestore_odm_generator: path: ../ + firebase_core_platform_interface: ^6.0.0 flutter_test: sdk: flutter - freezed: ^3.0.2 - json_serializable: ^6.9.4 - test: ^1.25.1 - firebase_core_platform_interface: ^6.0.0 + freezed: ^3.2.0 + json_serializable: ^6.11.0 + test: ^1.25.15 dependency_overrides: cloud_firestore_odm: diff --git a/packages/cloud_firestore_odm_generator/cloud_firestore_odm_generator_integration_test/test/collection_test.dart b/packages/cloud_firestore_odm_generator/cloud_firestore_odm_generator_integration_test/test/collection_test.dart index 7970f35..62a7da8 100644 --- a/packages/cloud_firestore_odm_generator/cloud_firestore_odm_generator_integration_test/test/collection_test.dart +++ b/packages/cloud_firestore_odm_generator/cloud_firestore_odm_generator_integration_test/test/collection_test.dart @@ -36,8 +36,7 @@ void main() { }); group('doc', () { - test('asserts that the path does not point to a separate collection', - () async { + test('asserts that the path does not point to a separate collection', () async { rootRef.doc('42'); expect( @@ -54,7 +53,7 @@ void main() { /// test freezed mixed mode classes group('freezed mixed mode classes', () { test('test freezed simple classes', () { - final simpleFreezed = SimpleFreezed(a: 42); + const simpleFreezed = SimpleFreezed(a: 42); expect(simpleFreezed.toJson(), {'a': 42}); final simpleFreezedFromJson = SimpleFreezed.fromJson({'a': 42}); @@ -65,8 +64,7 @@ void main() { final publicRedirected = PublicRedirected(value: 'test'); expect(publicRedirected.toJson(), {'value': 'test'}); - final publicRedirectedFromJson = - PublicRedirected.fromJson({'value': 'test'}); + final publicRedirectedFromJson = PublicRedirected.fromJson({'value': 'test'}); expect(publicRedirectedFromJson.value, 'test'); }); }); diff --git a/packages/cloud_firestore_odm_generator/cloud_firestore_odm_generator_integration_test/test/setup_firestore_mock.dart b/packages/cloud_firestore_odm_generator/cloud_firestore_odm_generator_integration_test/test/setup_firestore_mock.dart index 9bd0210..f0ffbd4 100644 --- a/packages/cloud_firestore_odm_generator/cloud_firestore_odm_generator_integration_test/test/setup_firestore_mock.dart +++ b/packages/cloud_firestore_odm_generator/cloud_firestore_odm_generator_integration_test/test/setup_firestore_mock.dart @@ -17,9 +17,6 @@ void setupFirestoreMocks() { } class MockFirebasePlatform extends FirebasePlatform { - @override - bool get isAutomaticDataCollectionEnabled => true; - @override Future initializeApp({ String? name, @@ -37,13 +34,14 @@ class MockFirebasePlatform extends FirebasePlatform { class MockFirebaseAppPlatform extends FirebaseAppPlatform { MockFirebaseAppPlatform() : super( - defaultFirebaseAppName, - const FirebaseOptions( - apiKey: 'mock-api-key', - appId: 'mock-app-id', - messagingSenderId: 'mock-sender-id', - projectId: 'mock-project-id', - )); + defaultFirebaseAppName, + const FirebaseOptions( + apiKey: 'mock-api-key', + appId: 'mock-app-id', + messagingSenderId: 'mock-sender-id', + projectId: 'mock-project-id', + ), + ); @override String get name => defaultFirebaseAppName; diff --git a/packages/cloud_firestore_odm_generator/lib/src/collection_data.dart b/packages/cloud_firestore_odm_generator/lib/src/collection_data.dart index 8cc9672..5df4ed8 100644 --- a/packages/cloud_firestore_odm_generator/lib/src/collection_data.dart +++ b/packages/cloud_firestore_odm_generator/lib/src/collection_data.dart @@ -3,7 +3,7 @@ // BSD-style license that can be found in the LICENSE file. import 'package:analyzer/dart/constant/value.dart'; -import 'package:analyzer/dart/element/element.dart'; +import 'package:analyzer/dart/element/element2.dart'; import 'package:analyzer/dart/element/type.dart'; import 'package:cloud_firestore_odm/annotation.dart'; import 'package:collection/collection.dart'; @@ -15,9 +15,9 @@ import 'package:source_helper/source_helper.dart'; import 'collection_generator.dart'; import 'names.dart'; -const collectionChecker = TypeChecker.fromRuntime(Collection); -const jsonSerializableChecker = TypeChecker.fromRuntime(JsonSerializable); -const freezedChecker = TypeChecker.fromRuntime(Freezed); +const collectionChecker = TypeChecker.typeNamed(Collection); +const jsonSerializableChecker = TypeChecker.typeNamed(JsonSerializable); +const freezedChecker = TypeChecker.typeNamed(Freezed); class CollectionGraph { CollectionGraph._(this.roots, this.subCollections); @@ -88,15 +88,15 @@ class CollectionData with Names { required this.perFieldToJson, required this.idKey, required this.libraryElement, - }) : collectionName = - collectionName ?? ReCase(path.split('/').last).camelCase; + }) : collectionName = collectionName ?? ReCase(path.split('/').last).camelCase; factory CollectionData.fromAnnotation({ - required LibraryElement libraryElement, - required Element annotatedElement, + required LibraryElement2 libraryElement, + required Element2 annotatedElement, required DartObject annotation, required GlobalData globalData, }) { + print('annotation: ${annotation}'); // TODO find a way to test validation final name = annotation.getField('name')!.toStringValue(); @@ -118,8 +118,8 @@ class CollectionData with Names { ); } - final collectionTargetElement = type.element; - if (collectionTargetElement is! ClassElement) { + final collectionTargetElement = type.element3; + if (collectionTargetElement is! ClassElement2) { throw InvalidGenerationSourceError( 'The annotation @Collection can only receive classes as generic argument. ', element: annotatedElement, @@ -127,44 +127,37 @@ class CollectionData with Names { } final hasFreezed = freezedChecker.hasAnnotationOf(collectionTargetElement); - final redirectedFreezedConstructors = - collectionTargetElement.constructors.where( - (element) { - return element.isFactory && - // It should be safe to read "redirectedConstructor" as the build.yaml - // asks to run the ODM after Freezed - element.redirectedConstructor != null; - }, - ).toList(); + final redirectedFreezedConstructors = collectionTargetElement.constructors2.where((element) { + return element.isFactory && + // It should be safe to read "redirectedConstructor" as the build.yaml + // asks to run the ODM after Freezed + element.redirectedConstructor2 != null; + }).toList(); - final hasJsonSerializable = - jsonSerializableChecker.hasAnnotationOf(collectionTargetElement); + final hasJsonSerializable = jsonSerializableChecker.hasAnnotationOf(collectionTargetElement); // Freezed classes are also JsonSerializable if (!hasJsonSerializable && !hasFreezed) { throw InvalidGenerationSourceError( - 'Used @Collection with the class ${collectionTargetElement.name}, but ' + 'Used @Collection with the class ${collectionTargetElement.name3}, but ' 'the class has no @JsonSerializable annotation.', ); } - final annotatedElementSource = annotatedElement.librarySource; + final annotatedElementSource = annotatedElement.library2; // TODO(rrousselGit) handle parts // Whether the model class and the reference variable are defined in the same file // This is important because json_serializable generates private code for // decoding a Model class. final modelAndReferenceInTheSameLibrary = - collectionTargetElement.librarySource == annotatedElementSource; + collectionTargetElement.library2 == annotatedElementSource; if (!modelAndReferenceInTheSameLibrary) { - throw InvalidGenerationSourceError( - ''' + throw InvalidGenerationSourceError(''' When using json_serializable, the `@Collection` annotation and the class that represents the content of the collection must be in the same file. - @Collection is from $annotatedElementSource -- `$collectionTargetElement` is from ${collectionTargetElement.librarySource} -''', - element: annotatedElement, - ); +- `$collectionTargetElement` is from ${collectionTargetElement.library2} +''', element: annotatedElement); } // TODO test error handling @@ -175,17 +168,17 @@ represents the content of the collection must be in the same file. ); } - final collectionTargetElementPublicType = - collectionTargetElement.name.public; - final fromJson = collectionTargetElement.constructors - .firstWhereOrNull((ctor) => ctor.name == 'fromJson'); + final collectionTargetElementPublicType = collectionTargetElement.name3?.public ?? ''; + final fromJson = collectionTargetElement.constructors2.firstWhereOrNull( + (ctor) => ctor.name3 == 'fromJson', + ); if (fromJson != null) { - if (fromJson.parameters.length != 1 || - !fromJson.parameters.first.isRequiredPositional || - !fromJson.parameters.first.type.isDartCoreMap) { + if (fromJson.formalParameters.length != 1 || + !fromJson.formalParameters.first.isRequiredPositional || + !fromJson.formalParameters.last.type.isDartCoreMap) { // TODO support deserializing generic objects throw InvalidGenerationSourceError( - '@Collection was used with the class ${collectionTargetElement.name} but ' + '@Collection was used with the class ${collectionTargetElement.name3} but ' 'its fromJson does not match `Function(Map json)`.', element: annotatedElement, ); @@ -194,19 +187,19 @@ represents the content of the collection must be in the same file. final toJson = collectionTargetElement // Looking into fromJson from superTypes too .allMethods - .firstWhereOrNull((method) => method.name == 'toJson'); - final redirectedFreezedClass = redirectedFreezedConstructors - .singleOrNull?.redirectedConstructor!.enclosingElement3.name; + .firstWhereOrNull((method) => method.name3 == 'toJson'); + final redirectedFreezedClass = + redirectedFreezedConstructors.singleOrNull?.redirectedConstructor2!.enclosingElement2.name3; final generatedJsonTypePrefix = _generatedJsonTypePrefix( hasFreezed: hasFreezed, redirectedFreezedClass: redirectedFreezedClass, collectionTargetElementPublicType: collectionTargetElementPublicType, ); if (toJson != null) { - if (toJson.parameters.isNotEmpty || !toJson.returnType.isDartCoreMap) { + if (toJson.formalParameters.isNotEmpty || !toJson.returnType.isDartCoreMap) { // TODO support serializing generic objects throw InvalidGenerationSourceError( - '@Collection was used with the class ${collectionTargetElement.name} but ' + '@Collection was used with the class ${collectionTargetElement.name3} but ' 'its toJson does not match `Map Function()`.', element: annotatedElement, ); @@ -226,15 +219,11 @@ represents the content of the collection must be in the same file. if (toJson != null) return '$value.toJson()'; return '${generatedJsonTypePrefix}ToJson($value)'; }, - perFieldToJson: (field) => - '${generatedJsonTypePrefix}PerFieldToJson.$field', + perFieldToJson: (field) => '${generatedJsonTypePrefix}PerFieldToJson.$field', idKey: collectionTargetElement - .allFields( - hasFreezed: hasFreezed, - freezedConstructors: redirectedFreezedConstructors, - ) + .allFields(hasFreezed: hasFreezed, freezedConstructors: redirectedFreezedConstructors) .firstWhereOrNull((f) => f.hasId()) - ?.name, + ?.name3, queryableFields: [ QueryingField( 'fieldPath', @@ -277,34 +266,31 @@ represents the content of the collection must be in the same file. /// ```dart /// collection.orderByTitle(startAt: 'title'); /// ```''', - annotatedElement.library!.typeProvider.objectType, + annotatedElement.library2!.typeProvider.objectType, field: 'fieldPath', updatable: false, ), QueryingField( 'documentId', - annotatedElement.library!.typeProvider.stringType, + annotatedElement.library2!.typeProvider.stringType, whereDoc: '', // Inherited orderByDoc: '', // Inherited field: 'FieldPath.documentId', updatable: false, ), ...collectionTargetElement - .allFields( - hasFreezed: hasFreezed, - freezedConstructors: redirectedFreezedConstructors, - ) + .allFields(hasFreezed: hasFreezed, freezedConstructors: redirectedFreezedConstructors) .where((f) => f.isPublic) .where((f) => !f.hasId()) .where((f) => !f.isJsonIgnored()) .map( (f) => QueryingField( - f.name, + f.name3!, f.type, whereDoc: '', orderByDoc: '', updatable: true, - field: "${generatedJsonTypePrefix}FieldMap['${f.name}']!", + field: "${generatedJsonTypePrefix}FieldMap['${f.name3}']!", ), ) .toList(), @@ -313,8 +299,7 @@ represents the content of the collection must be in the same file. final classPrefix = data.classPrefix; - if (globalData.classPrefixesForLibrary[annotatedElementSource] - ?.contains(classPrefix) ?? + if (globalData.classPrefixesForLibrary[annotatedElementSource]?.contains(classPrefix) ?? false) { throw InvalidGenerationSourceError( 'Defined a collection with duplicate class prefix $classPrefix. ' @@ -323,13 +308,12 @@ represents the content of the collection must be in the same file. } globalData.classPrefixesForLibrary[annotatedElementSource] ??= []; - globalData.classPrefixesForLibrary[annotatedElementSource]! - .add(classPrefix); + globalData.classPrefixesForLibrary[annotatedElementSource]!.add(classPrefix); return data; } - static void _assertIsValidCollectionPath(String? path, Element element) { + static void _assertIsValidCollectionPath(String? path, Element2 element) { if (path == null) { throw InvalidGenerationSourceError( 'The annotation @Collection received "$path" as collection path, ' @@ -377,8 +361,7 @@ represents the content of the collection must be in the same file. required String collectionTargetElementPublicType, }) { if (hasFreezed) { - final className = - redirectedFreezedClass?.public ?? collectionTargetElementPublicType; + final className = redirectedFreezedClass?.public ?? collectionTargetElementPublicType; // Only support freezed 3.x or higher return '_\$$className'; } else { @@ -395,10 +378,9 @@ represents the content of the collection must be in the same file. final String path; final String? idKey; final List queryableFields; - final LibraryElement libraryElement; + final LibraryElement2 libraryElement; - late final updatableFields = - queryableFields.where((element) => element.updatable).toList(); + late final updatableFields = queryableFields.where((element) => element.updatable).toList(); CollectionData? _parent; CollectionData? get parent => _parent; @@ -416,18 +398,18 @@ represents the content of the collection must be in the same file. } } -extension on ClassElement { - Iterable get allMethods sync* { - yield* methods; +extension on ClassElement2 { + Iterable get allMethods sync* { + yield* methods2; for (final supertype in allSupertypes) { if (supertype.isDartCoreObject) continue; - yield* supertype.methods; + yield* supertype.methods2; } } - Iterable allFields({ + Iterable allFields({ required bool hasFreezed, - required List freezedConstructors, + required List freezedConstructors, }) { if (hasFreezed) { /// For Freezed 3.x, support mixed mode classes. There can be the classic freezed way with a factory, @@ -435,29 +417,26 @@ extension on ClassElement { /// /// We need to find the factory constructor, or the normal constructor if there is no factory. final factoryConstructor = freezedConstructors.firstWhereOrNull( - (ctor) => - ctor.isFactory && - !ctor.name.startsWith('_') && - ctor.name != 'fromJson', + (ctor) => ctor.isFactory && !ctor.name3!.startsWith('_') && ctor.name3 != 'fromJson', ); if (factoryConstructor == null) { // No factory constructor, use the normal constructor - return fields; + return fields2; } - return factoryConstructor.parameters; + return factoryConstructor.formalParameters; } else { - final uniqueFields = {}; + final uniqueFields = {}; - final allFields = const [].followedBy(fields).followedBy( - allSupertypes - .where((e) => !e.isDartCoreObject) - .expand((e) => e.element.fields), + final allFields = const [] + .followedBy(fields2) + .followedBy( + allSupertypes.where((e) => !e.isDartCoreObject).expand((e) => e.element3.fields2), ); for (final field in allFields) { - if (field.getter != null && !field.getter!.isSynthetic) continue; + if (field.getter2 != null && !field.getter2!.isSynthetic) continue; if (field.isStatic) continue; - uniqueFields[field.name] ??= field; + uniqueFields[field.name3!] ??= field; } return uniqueFields.values; } @@ -475,10 +454,9 @@ const _coreSetChecker = TypeChecker.fromUrl('dart:core#Set'); extension DartTypeExtension on DartType { bool get isJsonDocumentReference { - return element?.librarySource?.uri.scheme == 'package' && - const {'cloud_firestore'} - .contains(element?.librarySource?.uri.pathSegments.first) && - element?.name == 'DocumentReference' && + return element3?.library2?.uri.scheme == 'package' && + const {'cloud_firestore'}.contains(element3?.library2?.uri.pathSegments.first) && + element3?.name3 == 'DocumentReference' && (this as InterfaceType).typeArguments.single.isDartCoreMap; } @@ -500,9 +478,9 @@ extension DartTypeExtension on DartType { } } -extension on Element { +extension on Element2 { bool isJsonIgnored() { - const checker = TypeChecker.fromRuntime(JsonKey); + const checker = TypeChecker.typeNamed(JsonKey); final jsonKeys = checker.annotationsOf(this); for (final jsonKey in jsonKeys) { @@ -511,7 +489,7 @@ extension on Element { // ignore is deprecated in favor of includeFromJson and includeToJson final jsonIncluded = (jsonKey.getField('includeFromJson')?.toBoolValue() ?? true) && - (jsonKey.getField('includeToJson')?.toBoolValue() ?? true); + (jsonKey.getField('includeToJson')?.toBoolValue() ?? true); if (ignore || !jsonIncluded) { return true; } @@ -521,7 +499,7 @@ extension on Element { } bool hasId() { - const checker = TypeChecker.fromRuntime(Id); + const checker = TypeChecker.typeNamed(Id); return checker.hasAnnotationOf(this); } } diff --git a/packages/cloud_firestore_odm_generator/lib/src/collection_generator.dart b/packages/cloud_firestore_odm_generator/lib/src/collection_generator.dart index b88cde5..1d71f9e 100644 --- a/packages/cloud_firestore_odm_generator/lib/src/collection_generator.dart +++ b/packages/cloud_firestore_odm_generator/lib/src/collection_generator.dart @@ -2,7 +2,7 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. -import 'package:analyzer/dart/element/element.dart'; +import 'package:analyzer/dart/element/element2.dart'; import 'package:analyzer/dart/element/type.dart'; import 'package:build/build.dart'; import 'package:cloud_firestore_odm/annotation.dart'; @@ -20,7 +20,7 @@ import 'templates/query_document_snapshot.dart'; import 'templates/query_reference.dart'; import 'templates/query_snapshot.dart'; -const namedQueryChecker = TypeChecker.fromRuntime(NamedQuery); +const namedQueryChecker = TypeChecker.typeNamed(NamedQuery); class QueryingField { QueryingField( @@ -66,21 +66,19 @@ class GlobalData { class CollectionGenerator extends ParserGenerator> { @override - GlobalData parseGlobalData(LibraryElement library) { + GlobalData parseGlobalData(LibraryElement2 library) { final globalData = GlobalData(); - for (final element in library.topLevelElements) { + for (final element in library.topLevelVariables) { for (final queryAnnotation in namedQueryChecker.annotationsOf(element)) { final queryData = NamedQueryData.fromAnnotation(queryAnnotation); - final hasCollectionWithMatchingModelType = - collectionChecker.annotationsOf(element).any( - (annotation) { - final collectionType = - CollectionData.modelTypeOfAnnotation(annotation); - return collectionType == queryData.type; - }, - ); + final hasCollectionWithMatchingModelType = collectionChecker.annotationsOf(element).any(( + annotation, + ) { + final collectionType = CollectionData.modelTypeOfAnnotation(annotation); + return collectionType == queryData.type; + }); if (!hasCollectionWithMatchingModelType) { throw InvalidGenerationSourceError( @@ -101,19 +99,18 @@ class CollectionGenerator Future parseElement( BuildStep buildStep, GlobalData globalData, - Element element, + Element2 element, ) async { final library = await buildStep.inputLibrary; - final collectionAnnotations = collectionChecker.annotationsOf(element).map( - (annotation) { - return CollectionData.fromAnnotation( - annotatedElement: element, - globalData: globalData, - libraryElement: library, - annotation: annotation, - ); - }, - ).toList(); + print('element: ${element}'); + final collectionAnnotations = collectionChecker.annotationsOf(element).map((annotation) { + return CollectionData.fromAnnotation( + annotatedElement: element, + globalData: globalData, + libraryElement: library, + annotation: annotation, + ); + }).toList(); return CollectionGraph.parse(collectionAnnotations); } @@ -141,10 +138,9 @@ const _sentinel = _Sentinel(); } @override - Iterable generateForData( - GlobalData globalData, - CollectionGraph data, - ) sync* { + Iterable generateForData(GlobalData globalData, CollectionGraph data) sync* { + print('data: ${data.allCollections.map((e) => e.collectionReferenceInterfaceName)}'); + for (final collection in data.allCollections) { yield CollectionReferenceTemplate(collection); yield DocumentReferenceTemplate(collection); diff --git a/packages/cloud_firestore_odm_generator/lib/src/parse_generator.dart b/packages/cloud_firestore_odm_generator/lib/src/parse_generator.dart index 9d04385..da313a2 100644 --- a/packages/cloud_firestore_odm_generator/lib/src/parse_generator.dart +++ b/packages/cloud_firestore_odm_generator/lib/src/parse_generator.dart @@ -4,80 +4,49 @@ import 'dart:async'; -import 'package:analyzer/dart/element/element.dart'; +import 'package:analyzer/dart/element/element2.dart'; import 'package:build/build.dart'; import 'package:source_gen/source_gen.dart'; -abstract class ParserGenerator +import 'collection_generator.dart'; + +abstract class ParserGenerator extends GeneratorForAnnotation { @override - FutureOr generate( - // ignore: avoid_renaming_method_parameters - LibraryReader oldLibrary, - BuildStep buildStep, - ) async { - final library = await buildStep.resolver.libraryFor( - await buildStep.resolver.assetIdForElement(oldLibrary.element), - ); - + FutureOr generate(LibraryReader libraryReader, BuildStep buildStep) async { + final library = libraryReader.element; final generationBuffer = StringBuffer(); // A set used to remove duplicate generations. This is for scenarios where // two annotations within the library want to generate the same code final generatedCache = {}; final globalData = parseGlobalData(library); - - var hasGeneratedGlobalCode = false; - - for (final element - in library.topLevelElements.where(typeChecker.hasAnnotationOf)) { - if (!hasGeneratedGlobalCode) { - hasGeneratedGlobalCode = true; - for (final generated - in generateForAll(globalData).map((e) => e.toString())) { - assert(generated.length == generated.trim().length); - if (generatedCache.add(generated)) { - generationBuffer.writeln(generated); - } - } - } - - final data = await parseElement(buildStep, globalData, element); - if (data == null) continue; - - for (final generated - in generateForData(globalData, data).map((e) => e.toString())) { - assert(generated.length == generated.trim().length); - - if (generatedCache.add(generated)) { - generationBuffer.writeln(generated); - } + for (final generated in generateForAll(globalData).map((e) => e.toString())) { + assert(generated.length == generated.trim().length); + if (generatedCache.add(generated)) { + generationBuffer.writeln(generated); } } - return generationBuffer.toString(); + return '$generationBuffer\n\n${await super.generate(libraryReader, buildStep)}'; } Iterable generateForAll(GlobalData globalData) sync* {} - GlobalData parseGlobalData(LibraryElement library); + GlobalData parseGlobalData(LibraryElement2 library); - FutureOr parseElement( - BuildStep buildStep, - GlobalData globalData, - Element element, - ); + FutureOr parseElement(BuildStep buildStep, GlobalData globalData, Element2 element); Iterable generateForData(GlobalData globalData, Data data); @override Stream generateForAnnotatedElement( - Element element, + Element2 element, ConstantReader annotation, BuildStep buildStep, ) async* { // implemented for source_gen_test – otherwise unused - final globalData = parseGlobalData(element.library!); + final globalData = parseGlobalData(element.library2!); final data = parseElement(buildStep, globalData, element); if (data == null) return; diff --git a/packages/cloud_firestore_odm_generator/lib/src/validator_generator.dart b/packages/cloud_firestore_odm_generator/lib/src/validator_generator.dart index d9811c9..9477ed2 100644 --- a/packages/cloud_firestore_odm_generator/lib/src/validator_generator.dart +++ b/packages/cloud_firestore_odm_generator/lib/src/validator_generator.dart @@ -4,7 +4,7 @@ import 'dart:async'; -import 'package:analyzer/dart/element/element.dart'; +import 'package:analyzer/dart/element/element2.dart'; import 'package:build/build.dart'; import 'package:source_gen/source_gen.dart'; @@ -14,18 +14,18 @@ class ValidatorGenerator extends Generator { final buffer = StringBuffer(); for (final classElement in library.classes) { - final validations = classElement.fields.expand((field) sync* { - final validators = field.metadata.where(isValidatorAnnotation); + final validations = classElement.fields2.expand((field) sync* { + final validators = field.metadata2.annotations.where(isValidatorAnnotation); for (final validator in validators) { - yield "${validator.toSource().replaceFirst('@', 'const ')}.validate(instance.${field.name}, '${field.name}');"; + yield "${validator.toSource().replaceFirst('@', 'const ')}.validate(instance.${field.name3}, '${field.name3}');"; } }).toList(); if (validations.isNotEmpty) { buffer ..write( - 'void _\$assert${classElement.name}(${classElement.name} instance) {', + 'void _\$assert${classElement.name3}(${classElement.name3} instance) {', ) ..writeAll(validations) ..write('}'); @@ -37,12 +37,12 @@ class ValidatorGenerator extends Generator { } bool isValidatorAnnotation(ElementAnnotation annotation) { - final element = annotation.element; - if (element == null || element is! ConstructorElement) return false; + final element = annotation.element2; + if (element == null || element is! ConstructorElement2) return false; - return element.enclosingElement3.allSupertypes.any((superType) { - return superType.element.name == 'Validator' && - superType.element.librarySource.uri.toString() == + return element.enclosingElement2.allSupertypes.any((superType) { + return superType.element3.name3 == 'Validator' && + superType.element3.library2.uri.toString() == 'package:cloud_firestore_odm/src/validator.dart'; }); } diff --git a/packages/cloud_firestore_odm_generator/pubspec.yaml b/packages/cloud_firestore_odm_generator/pubspec.yaml index caa7ec4..6b544c0 100644 --- a/packages/cloud_firestore_odm_generator/pubspec.yaml +++ b/packages/cloud_firestore_odm_generator/pubspec.yaml @@ -5,13 +5,15 @@ repository: https://github.com/firebaseextended/firestoreodm-flutter version: 1.2.0 environment: - sdk: ">=3.0.0 <4.0.0" + sdk: ">=3.8.0 <4.0.0" dependencies: - analyzer: ">=5.12.0 <8.0.0" - build: ^2.4.1 - build_config: ^1.1.2 - cloud_firestore_odm: ^1.2.0 + analyzer: ">=6.0.0 <9.0.0" + build: ^3.0.2 + build_config: ^1.2.0 + # cloud_firestore_odm: ^1.2.0 + cloud_firestore_odm: + path: ../cloud_firestore_odm collection: ^1.18.0 freezed_annotation: ^3.0.0 # Can be removed once this is fixed https://github.com/dart-lang/graphs/issues/86 @@ -19,12 +21,12 @@ dependencies: json_annotation: ^4.9.0 meta: ^1.12.0 recase: ^4.1.0 - source_gen: ^2.0.0 - source_helper: ^1.3.4 + source_gen: ^3.1.0 + source_helper: ^1.3.7 dev_dependencies: - build_runner: ^2.4.8 - expect_error: ^1.0.8 - json_serializable: ^6.9.4 - matcher: ^0.12.16 - test: ^1.25.1 + build_runner: ^2.7.0 + expect_error: ^1.0.10 + json_serializable: ^6.11.0 + matcher: ^0.12.17 + test: ^1.25.15 From fcd1361a4c74abdada0f989280a7a71754676c83 Mon Sep 17 00:00:00 2001 From: dorklein Date: Fri, 29 Aug 2025 16:09:06 +0700 Subject: [PATCH 4/7] chore: Bump version to 1.3.0 and upgrade dependencies for cloud_firestore_odm and generator - Updated version to 1.3.0 in pubspec.yaml files - Upgraded packages to support analyzer ^8 and set minimum SDK to 3.8.0 - Updated CHANGELOG to reflect changes --- packages/cloud_firestore_odm/CHANGELOG.md | 3 +++ packages/cloud_firestore_odm/pubspec.yaml | 2 +- packages/cloud_firestore_odm_generator/CHANGELOG.md | 3 +++ packages/cloud_firestore_odm_generator/pubspec.yaml | 9 +++++---- 4 files changed, 12 insertions(+), 5 deletions(-) diff --git a/packages/cloud_firestore_odm/CHANGELOG.md b/packages/cloud_firestore_odm/CHANGELOG.md index 8b10346..9fa6f9f 100644 --- a/packages/cloud_firestore_odm/CHANGELOG.md +++ b/packages/cloud_firestore_odm/CHANGELOG.md @@ -1,3 +1,6 @@ +## 1.3.0 +- **CHORE**: upgraded packages to support analyzer ^8 and min sdk to 3.8.0 + ## 1.2.0 - **CHORE**: Update cloud_firestore to ^6.0.0 diff --git a/packages/cloud_firestore_odm/pubspec.yaml b/packages/cloud_firestore_odm/pubspec.yaml index 9a8edd4..877eb88 100644 --- a/packages/cloud_firestore_odm/pubspec.yaml +++ b/packages/cloud_firestore_odm/pubspec.yaml @@ -2,7 +2,7 @@ name: cloud_firestore_odm description: An ODM for Firebase Cloud Firestore (cloud_firestore). homepage: https://github.com/firebaseextended/firestoreodm-flutter repository: https://github.com/firebaseextended/firestoreodm-flutter -version: 1.2.0 +version: 1.3.0 false_secrets: - example/** diff --git a/packages/cloud_firestore_odm_generator/CHANGELOG.md b/packages/cloud_firestore_odm_generator/CHANGELOG.md index ae0f17d..db5cbc8 100644 --- a/packages/cloud_firestore_odm_generator/CHANGELOG.md +++ b/packages/cloud_firestore_odm_generator/CHANGELOG.md @@ -1,3 +1,6 @@ +## 1.3.0 +- **CHORE**: upgraded packages to support analyzer ^8 and min sdk to 3.8.0 + ## 1.2.0 - **FIX**: `set`, `batchSet` and `transacrtionSet` methods would keep the `@ID() id` in the object in DB. - **CHORE**: Update cloud_firestore to ^6.0.0 diff --git a/packages/cloud_firestore_odm_generator/pubspec.yaml b/packages/cloud_firestore_odm_generator/pubspec.yaml index 6b544c0..7ff59fe 100644 --- a/packages/cloud_firestore_odm_generator/pubspec.yaml +++ b/packages/cloud_firestore_odm_generator/pubspec.yaml @@ -2,7 +2,7 @@ name: cloud_firestore_odm_generator description: A code generator for cloud_firestore_odm. homepage: https://firebase.flutter.dev/docs/firestore/odm repository: https://github.com/firebaseextended/firestoreodm-flutter -version: 1.2.0 +version: 1.3.0 environment: sdk: ">=3.8.0 <4.0.0" @@ -11,9 +11,10 @@ dependencies: analyzer: ">=6.0.0 <9.0.0" build: ^3.0.2 build_config: ^1.2.0 - # cloud_firestore_odm: ^1.2.0 - cloud_firestore_odm: - path: ../cloud_firestore_odm + cloud_firestore_odm: ^1.2.0 + # For testing locally + # cloud_firestore_odm: + # path: ../cloud_firestore_odm collection: ^1.18.0 freezed_annotation: ^3.0.0 # Can be removed once this is fixed https://github.com/dart-lang/graphs/issues/86 From 6f29f11dd6b0f8dbfb59482d9be5a8fa9aadb8cf Mon Sep 17 00:00:00 2001 From: Dor Klein Date: Fri, 29 Aug 2025 12:17:31 +0300 Subject: [PATCH 5/7] Update README.md Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index c0cf42a..bbc6818 100644 --- a/README.md +++ b/README.md @@ -40,7 +40,7 @@ That is done by adding the following to your `pubspec.yaml`: ```yaml environment: - sdk: ">=3.0.0 <4.0.0" + sdk: ">=3.8.0 <4.0.0" ``` ### 2. FlutterFire Initialization From 389b61d77efbde5306d44cc243b2516776118666 Mon Sep 17 00:00:00 2001 From: dorklein Date: Fri, 29 Aug 2025 16:18:47 +0700 Subject: [PATCH 6/7] refactor: Simplify test assertions and remove debug print statements - Streamlined expect statements in integration tests for better readability. - Removed unnecessary print statements from collection data and generator files. - Enhanced code clarity by consolidating multi-line statements into single lines where appropriate. --- .../document_reference_test.dart | 108 +++++++----------- .../lib/src/collection_data.dart | 1 - .../lib/src/collection_generator.dart | 3 - 3 files changed, 40 insertions(+), 72 deletions(-) diff --git a/packages/cloud_firestore_odm/example/integration_test/document_reference_test.dart b/packages/cloud_firestore_odm/example/integration_test/document_reference_test.dart index 093e409..c034769 100644 --- a/packages/cloud_firestore_odm/example/integration_test/document_reference_test.dart +++ b/packages/cloud_firestore_odm/example/integration_test/document_reference_test.dart @@ -35,19 +35,13 @@ void main() { await collection.doc('123').set(createMovie(title: 'title')); - expect( - await collection.doc('123').get().then((e) => e.exists), - true, - ); + expect(await collection.doc('123').get().then((e) => e.exists), true); await FirebaseFirestore.instance.runTransaction((transaction) async { collection.doc('123').transactionDelete(transaction); }); - expect( - await collection.doc('123').get().then((e) => e.exists), - false, - ); + expect(await collection.doc('123').get().then((e) => e.exists), false); }); test('batch', () async { @@ -86,11 +80,7 @@ void main() { collection.doc(movieToSet).get().then((e) => e.data), collection.doc(movieToDelete).get().then((e) => e.exists), ]), - [ - updatedTitle, - isA().having((e) => e.title, newTitle, newTitle), - false, - ], + [updatedTitle, isA().having((e) => e.title, newTitle, newTitle), false], ); }); @@ -99,24 +89,21 @@ void main() { await collection.doc('123').set(createMovie(title: 'title')); - expect( - await collection.doc('123').get().then((e) => e.exists), - true, - ); + expect(await collection.doc('123').get().then((e) => e.exists), true); await collection.doc('123').delete(); - expect( - await collection.doc('123').get().then((e) => e.exists), - false, - ); + expect(await collection.doc('123').get().then((e) => e.exists), false); }); test('reference', () async { expect( MovieCollectionReference().doc('123').reference, - isA>() - .having((e) => e.path, 'path', 'firestore-example-app/123'), + isA>().having( + (e) => e.path, + 'path', + 'firestore-example-app/123', + ), ); expect( @@ -138,11 +125,9 @@ void main() { expect( await collection.doc('123').get(const GetOptions(source: Source.cache)), - isA().having((e) => e.data?.title, 'data.title', 'title').having( - (e) => e.metadata.isFromCache, - 'metadata.isFromCache', - true, - ), + isA() + .having((e) => e.data?.title, 'data.title', 'title') + .having((e) => e.metadata.isFromCache, 'metadata.isFromCache', true), ); }); }); @@ -156,8 +141,6 @@ void main() { (transaction) => collection.doc('123').transactionGet(transaction), ); - print('result.data ${result.data}'); - print('result.data ${result.data}'); expect(result.id, '123'); expect(result.data?.title, 'title'); }); @@ -188,7 +171,9 @@ void main() { test('allows modifying a single property of an object', () async { final ref = await initializeTest(moviesRef); - await ref.doc('123').set( + await ref + .doc('123') + .set( Movie( genre: [], likes: 42, @@ -245,10 +230,7 @@ void main() { ); await FirebaseFirestore.instance.runTransaction((transaction) async { - ref.doc('123').transactionSet( - transaction, - createMovie(title: 'Foo'), - ); + ref.doc('123').transactionSet(transaction, createMovie(title: 'Foo')); }); expect( @@ -291,7 +273,9 @@ void main() { test('allows modifying only one property of an object', () async { final ref = await initializeTest(moviesRef); - await ref.doc('123').set( + await ref + .doc('123') + .set( Movie( genre: [], likes: 42, @@ -316,9 +300,7 @@ void main() { .having((e) => e.year, 'year', 0), ); - await ref.doc('123').update( - genre: ['genre'], - ); + await ref.doc('123').update(genre: ['genre']); expect( await ref.doc('123').get().then((e) => e.data), @@ -336,7 +318,9 @@ void main() { test('can set a property to null', () async { final ref = await initializeTest(moviesRef); - await ref.doc('123').set( + await ref + .doc('123') + .set( Movie( genre: [], likes: 42, @@ -361,7 +345,9 @@ void main() { .having((e) => e.year, 'year', 0), ); - await ref.doc('123').update( + await ref + .doc('123') + .update( // ignore: avoid_redundant_argument_values, false positive genre: null, ); @@ -400,14 +386,8 @@ void main() { await collection.doc('123').set(createMovie(title: 'Foo')); - expect( - await collection.doc().get().then((d) => d.exists), - false, - ); - expect( - await collection.doc('123').get().then((d) => d.exists), - true, - ); + expect(await collection.doc().get().then((d) => d.exists), false); + expect(await collection.doc('123').get().then((d) => d.exists), true); }); }); @@ -417,37 +397,29 @@ void main() { await collection.doc('123').set(OptionalJson(42)); - expect( - await collection.doc('123').get().then((value) => value.data?.value), - 42, - ); + expect(await collection.doc('123').get().then((value) => value.data?.value), 42); }); test( - 'if fromJson/toJson are specified, use them even if the model is annotated by JsonSerializable', - () async { - final collection = await initializeTest(mixedJsonRef); + 'if fromJson/toJson are specified, use them even if the model is annotated by JsonSerializable', + () async { + final collection = await initializeTest(mixedJsonRef); - await collection.doc('123').set(MixedJson(42)); + await collection.doc('123').set(MixedJson(42)); - final rawSnapshot = await FirebaseFirestore.instance.collection('root').doc('123').get(); + final rawSnapshot = await FirebaseFirestore.instance.collection('root').doc('123').get(); - expect(rawSnapshot.data(), {'foo': 42}); - expect( - await collection.doc('123').get().then((value) => value.data?.value), - 42, - ); - }); + expect(rawSnapshot.data(), {'foo': 42}); + expect(await collection.doc('123').get().then((value) => value.data?.value), 42); + }, + ); test('overrides ==', () { expect( MovieCollectionReference().doc('123'), MovieCollectionReference(FirebaseFirestore.instance).doc('123'), ); - expect( - MovieCollectionReference().doc('123'), - isNot(MovieCollectionReference().doc('456')), - ); + expect(MovieCollectionReference().doc('123'), isNot(MovieCollectionReference().doc('456'))); expect( MovieCollectionReference(customFirestore).doc('123'), diff --git a/packages/cloud_firestore_odm_generator/lib/src/collection_data.dart b/packages/cloud_firestore_odm_generator/lib/src/collection_data.dart index 5df4ed8..8d77a65 100644 --- a/packages/cloud_firestore_odm_generator/lib/src/collection_data.dart +++ b/packages/cloud_firestore_odm_generator/lib/src/collection_data.dart @@ -96,7 +96,6 @@ class CollectionData with Names { required DartObject annotation, required GlobalData globalData, }) { - print('annotation: ${annotation}'); // TODO find a way to test validation final name = annotation.getField('name')!.toStringValue(); diff --git a/packages/cloud_firestore_odm_generator/lib/src/collection_generator.dart b/packages/cloud_firestore_odm_generator/lib/src/collection_generator.dart index 1d71f9e..dedbfe2 100644 --- a/packages/cloud_firestore_odm_generator/lib/src/collection_generator.dart +++ b/packages/cloud_firestore_odm_generator/lib/src/collection_generator.dart @@ -102,7 +102,6 @@ class CollectionGenerator Element2 element, ) async { final library = await buildStep.inputLibrary; - print('element: ${element}'); final collectionAnnotations = collectionChecker.annotationsOf(element).map((annotation) { return CollectionData.fromAnnotation( annotatedElement: element, @@ -139,8 +138,6 @@ const _sentinel = _Sentinel(); @override Iterable generateForData(GlobalData globalData, CollectionGraph data) sync* { - print('data: ${data.allCollections.map((e) => e.collectionReferenceInterfaceName)}'); - for (final collection in data.allCollections) { yield CollectionReferenceTemplate(collection); yield DocumentReferenceTemplate(collection); From 46f0c380a5904e3cae77f0b36c9c198ce08b8503 Mon Sep 17 00:00:00 2001 From: Dor Klein Date: Fri, 29 Aug 2025 12:19:05 +0300 Subject: [PATCH 7/7] Update packages/cloud_firestore_odm_generator/CHANGELOG.md Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> --- packages/cloud_firestore_odm_generator/CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/cloud_firestore_odm_generator/CHANGELOG.md b/packages/cloud_firestore_odm_generator/CHANGELOG.md index db5cbc8..58f2c8c 100644 --- a/packages/cloud_firestore_odm_generator/CHANGELOG.md +++ b/packages/cloud_firestore_odm_generator/CHANGELOG.md @@ -2,7 +2,7 @@ - **CHORE**: upgraded packages to support analyzer ^8 and min sdk to 3.8.0 ## 1.2.0 -- **FIX**: `set`, `batchSet` and `transacrtionSet` methods would keep the `@ID() id` in the object in DB. +- **FIX**: `set`, `batchSet` and `transactionSet` methods would keep the `@ID() id` in the object in DB. - **CHORE**: Update cloud_firestore to ^6.0.0 ## 1.1.0