diff --git a/.github/workflows/.env b/.github/workflows/.env index 7e267b6..e62fbf5 100644 --- a/.github/workflows/.env +++ b/.github/workflows/.env @@ -1 +1 @@ -FLUTTER_VERSION=3.24.3 \ No newline at end of file +FLUTTER_VERSION=3.35.3 \ No newline at end of file diff --git a/.github/workflows/flutter_reach_five.yaml b/.github/workflows/flutter_reach_five.yaml index 6620d3c..48888e4 100644 --- a/.github/workflows/flutter_reach_five.yaml +++ b/.github/workflows/flutter_reach_five.yaml @@ -3,29 +3,29 @@ name: Test Flutter Reach Five on: push: paths: - - "flutter_reach_five/**" - - ".github/workflows/flutter_reach_five.yaml" + - 'flutter_reach_five/**' + - '.github/workflows/flutter_reach_five.yaml' branches: - main pull_request: paths: - - "flutter_reach_five/**" - - ".github/workflows/flutter_reach_five.yaml" + - 'flutter_reach_five/**' + - '.github/workflows/flutter_reach_five.yaml' branches: - main jobs: test: strategy: - matrix: {dir: ["flutter_reach_five"]} - runs-on: ubuntu-20.04 + matrix: { dir: ['flutter_reach_five'] } + runs-on: ubuntu-latest defaults: run: working-directory: ${{ matrix.dir }} steps: - uses: actions/checkout@v3.3.0 - + - id: dotenv uses: falti/dotenv-action@v1.0.2 with: @@ -34,7 +34,7 @@ jobs: - uses: subosito/flutter-action@v2.8.0 with: flutter-version: ${{ steps.dotenv.outputs.flutter_version }} - channel: "stable" + channel: 'stable' cache: true cache-key: ${{ runner.os }}-flutter-${{ steps.dotenv.outputs.flutter_version }} cache-path: ${{ runner.tool_cache }}/flutter-${{ steps.dotenv.outputs.flutter_version }} @@ -65,5 +65,5 @@ jobs: - name: Check Code Coverage uses: VeryGoodOpenSource/very_good_coverage@v2.1.0 with: - path: "./${{ matrix.dir }}/coverage/lcov.info" + path: './${{ matrix.dir }}/coverage/lcov.info' min_coverage: 100 diff --git a/.github/workflows/flutter_reach_five_android.yaml b/.github/workflows/flutter_reach_five_android.yaml index 9a028f3..448a427 100644 --- a/.github/workflows/flutter_reach_five_android.yaml +++ b/.github/workflows/flutter_reach_five_android.yaml @@ -3,29 +3,29 @@ name: Test Flutter Reach Five Android on: push: paths: - - "flutter_reach_five_android/**" - - ".github/workflows/flutter_reach_five_android.yaml" + - 'flutter_reach_five_android/**' + - '.github/workflows/flutter_reach_five_android.yaml' branches: - main pull_request: paths: - - "flutter_reach_five_android/**" - - ".github/workflows/flutter_reach_five_android.yaml" + - 'flutter_reach_five_android/**' + - '.github/workflows/flutter_reach_five_android.yaml' branches: - main jobs: test: strategy: - matrix: {dir: ["flutter_reach_five_android"]} - runs-on: ubuntu-20.04 + matrix: { dir: ['flutter_reach_five_android'] } + runs-on: ubuntu-latest defaults: run: working-directory: ${{ matrix.dir }} steps: - uses: actions/checkout@v3.3.0 - + - id: dotenv uses: falti/dotenv-action@v1.0.2 with: @@ -34,7 +34,7 @@ jobs: - uses: subosito/flutter-action@v2.8.0 with: flutter-version: ${{ steps.dotenv.outputs.flutter_version }} - channel: "stable" + channel: 'stable' cache: true cache-key: ${{ runner.os }}-flutter-${{ steps.dotenv.outputs.flutter_version }} cache-path: ${{ runner.tool_cache }}/flutter-${{ steps.dotenv.outputs.flutter_version }} @@ -60,5 +60,5 @@ jobs: - name: Check Code Coverage uses: VeryGoodOpenSource/very_good_coverage@v2.1.0 with: - path: "./${{ matrix.dir }}/coverage/lcov.info" + path: './${{ matrix.dir }}/coverage/lcov.info' min_coverage: 100 diff --git a/.github/workflows/flutter_reach_five_ios.yaml b/.github/workflows/flutter_reach_five_ios.yaml index 227442d..19a4b9d 100644 --- a/.github/workflows/flutter_reach_five_ios.yaml +++ b/.github/workflows/flutter_reach_five_ios.yaml @@ -3,29 +3,29 @@ name: Test Flutter Reach Five iOS on: push: paths: - - "flutter_reach_five_ios/**" - - ".github/workflows/flutter_reach_five_ios.yaml" + - 'flutter_reach_five_ios/**' + - '.github/workflows/flutter_reach_five_ios.yaml' branches: - main pull_request: paths: - - "flutter_reach_five_ios/**" - - ".github/workflows/flutter_reach_five_ios.yaml" + - 'flutter_reach_five_ios/**' + - '.github/workflows/flutter_reach_five_ios.yaml' branches: - main jobs: test: strategy: - matrix: {dir: ["flutter_reach_five_ios"]} - runs-on: ubuntu-20.04 + matrix: { dir: ['flutter_reach_five_ios'] } + runs-on: ubuntu-latest defaults: run: working-directory: ${{ matrix.dir }} steps: - uses: actions/checkout@v3.3.0 - + - id: dotenv uses: falti/dotenv-action@v1.0.2 with: @@ -34,7 +34,7 @@ jobs: - uses: subosito/flutter-action@v2.8.0 with: flutter-version: ${{ steps.dotenv.outputs.flutter_version }} - channel: "stable" + channel: 'stable' cache: true cache-key: ${{ runner.os }}-flutter-${{ steps.dotenv.outputs.flutter_version }} cache-path: ${{ runner.tool_cache }}/flutter-${{ steps.dotenv.outputs.flutter_version }} @@ -60,5 +60,5 @@ jobs: - name: Check Code Coverage uses: VeryGoodOpenSource/very_good_coverage@v2.1.0 with: - path: "./${{ matrix.dir }}/coverage/lcov.info" + path: './${{ matrix.dir }}/coverage/lcov.info' min_coverage: 100 diff --git a/.github/workflows/flutter_reach_five_platform_interface.yaml b/.github/workflows/flutter_reach_five_platform_interface.yaml index f47a1e3..c156ff6 100644 --- a/.github/workflows/flutter_reach_five_platform_interface.yaml +++ b/.github/workflows/flutter_reach_five_platform_interface.yaml @@ -3,29 +3,29 @@ name: Test Flutter Reach Five Platform Interface on: push: paths: - - "flutter_reach_five_platform_interface/**" - - ".github/workflows/flutter_reach_five_platform_interface.yaml" + - 'flutter_reach_five_platform_interface/**' + - '.github/workflows/flutter_reach_five_platform_interface.yaml' branches: - main pull_request: paths: - - "flutter_reach_five_platform_interface/**" - - ".github/workflows/flutter_reach_five_platform_interface.yaml" + - 'flutter_reach_five_platform_interface/**' + - '.github/workflows/flutter_reach_five_platform_interface.yaml' branches: - main jobs: test: strategy: - matrix: {dir: ["flutter_reach_five_platform_interface"]} - runs-on: ubuntu-20.04 + matrix: { dir: ['flutter_reach_five_platform_interface'] } + runs-on: ubuntu-latest defaults: run: working-directory: ${{ matrix.dir }} steps: - uses: actions/checkout@v3.3.0 - + - id: dotenv uses: falti/dotenv-action@v1.0.2 with: @@ -34,7 +34,7 @@ jobs: - uses: subosito/flutter-action@v2.8.0 with: flutter-version: ${{ steps.dotenv.outputs.flutter_version }} - channel: "stable" + channel: 'stable' cache: true cache-key: ${{ runner.os }}-flutter-${{ steps.dotenv.outputs.flutter_version }} cache-path: ${{ runner.tool_cache }}/flutter-${{ steps.dotenv.outputs.flutter_version }} @@ -60,5 +60,5 @@ jobs: - name: Check Code Coverage uses: VeryGoodOpenSource/very_good_coverage@v2.1.0 with: - path: "./${{ matrix.dir }}/coverage/lcov.info" + path: './${{ matrix.dir }}/coverage/lcov.info' min_coverage: 100 diff --git a/.github/workflows/reach_five_identity_repo.yaml b/.github/workflows/reach_five_identity_repo.yaml index 3ca123f..4c3b0d3 100644 --- a/.github/workflows/reach_five_identity_repo.yaml +++ b/.github/workflows/reach_five_identity_repo.yaml @@ -3,29 +3,29 @@ name: Test Flutter Reach Five Identity Repo on: push: paths: - - "reach_five_identity_repo/**" - - ".github/workflows/reach_five_identity_repo.yaml" + - 'reach_five_identity_repo/**' + - '.github/workflows/reach_five_identity_repo.yaml' branches: - main pull_request: paths: - - "reach_five_identity_repo/**" - - ".github/workflows/reach_five_identity_repo.yaml" + - 'reach_five_identity_repo/**' + - '.github/workflows/reach_five_identity_repo.yaml' branches: - main jobs: test: strategy: - matrix: {dir: ["reach_five_identity_repo"]} - runs-on: ubuntu-20.04 + matrix: { dir: ['reach_five_identity_repo'] } + runs-on: ubuntu-latest defaults: run: working-directory: ${{ matrix.dir }} steps: - uses: actions/checkout@v3.3.0 - + - id: dotenv uses: falti/dotenv-action@v1.0.2 with: @@ -34,7 +34,7 @@ jobs: - uses: subosito/flutter-action@v2.8.0 with: flutter-version: ${{ steps.dotenv.outputs.flutter_version }} - channel: "stable" + channel: 'stable' cache: true cache-key: ${{ runner.os }}-flutter-${{ steps.dotenv.outputs.flutter_version }} cache-path: ${{ runner.tool_cache }}/flutter-${{ steps.dotenv.outputs.flutter_version }} diff --git a/flutter_reach_five/example/pubspec.yaml b/flutter_reach_five/example/pubspec.yaml index 3b16a3c..75f32d2 100644 --- a/flutter_reach_five/example/pubspec.yaml +++ b/flutter_reach_five/example/pubspec.yaml @@ -4,8 +4,8 @@ version: 0.1.7 publish_to: none environment: - sdk: ">=3.0.0 <4.0.0" - flutter: ">=3.16.0" + sdk: '>=3.0.0 <4.0.0' + flutter: '>=3.16.0' dependencies: flutter: @@ -19,10 +19,6 @@ dependencies: path: ../ dev_dependencies: - # We force analyzer 5.4.0 to avoid version conflicts between the pubspec.lock of - # reachFice main package and this example - # cf this issue : https://github.com/invertase/dart_custom_lint/issues/111 - analyzer: 5.4.0 flutter_driver: sdk: flutter flutter_test: diff --git a/flutter_reach_five/lib/models/profile.dart b/flutter_reach_five/lib/models/profile.dart index 120e4b4..f92b1a4 100644 --- a/flutter_reach_five/lib/models/profile.dart +++ b/flutter_reach_five/lib/models/profile.dart @@ -9,7 +9,7 @@ part 'profile.freezed.dart'; /// [Profile] class, contains the infos of an user @freezed -class Profile with _$Profile { +abstract class Profile with _$Profile { /// [Profile] default constructor const factory Profile({ /// The user id diff --git a/flutter_reach_five/lib/models/profile.freezed.dart b/flutter_reach_five/lib/models/profile.freezed.dart index d97a51c..a2f8f30 100644 --- a/flutter_reach_five/lib/models/profile.freezed.dart +++ b/flutter_reach_five/lib/models/profile.freezed.dart @@ -1,5 +1,5 @@ -// 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 @@ -9,107 +9,198 @@ part of 'profile.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#custom-getters-and-methods'); - /// @nodoc mixin _$Profile { /// The user id - String? get uid => throw _privateConstructorUsedError; + String? get uid; /// The user given name - String? get givenName => throw _privateConstructorUsedError; + String? get givenName; /// The user middle name - String? get middleName => throw _privateConstructorUsedError; + String? get middleName; /// The user family name - String? get familyName => throw _privateConstructorUsedError; + String? get familyName; /// The user name - String? get name => throw _privateConstructorUsedError; + String? get name; /// The user nickname - String? get nickname => throw _privateConstructorUsedError; + String? get nickname; /// The user birthdate - String? get birthdate => throw _privateConstructorUsedError; + String? get birthdate; /// The user profile url - String? get profileURL => throw _privateConstructorUsedError; + String? get profileURL; /// The user picture - String? get picture => throw _privateConstructorUsedError; + String? get picture; /// The user external id - String? get externalId => throw _privateConstructorUsedError; + String? get externalId; /// The user list of authentication types - List? get authTypes => throw _privateConstructorUsedError; + List? get authTypes; /// The user [LoginSummary] - LoginSummary? get loginSummary => throw _privateConstructorUsedError; + LoginSummary? get loginSummary; /// The user username - String? get username => throw _privateConstructorUsedError; + String? get username; /// The user gender - String? get gender => throw _privateConstructorUsedError; + String? get gender; /// The user email - String? get email => throw _privateConstructorUsedError; + String? get email; /// Used to check if an user [email] is verified or not - bool? get emailVerified => throw _privateConstructorUsedError; + bool? get emailVerified; /// The user list of verified/unverified emails - Emails? get emails => throw _privateConstructorUsedError; + Emails? get emails; /// The user phone number - String? get phoneNumber => throw _privateConstructorUsedError; + String? get phoneNumber; /// Used to check if an user [phoneNumber] is verified or not - bool? get phoneNumberVerified => throw _privateConstructorUsedError; + bool? get phoneNumberVerified; /// The user list of addresses - List? get addresses => throw _privateConstructorUsedError; + List? get addresses; /// The user locale - String? get locale => throw _privateConstructorUsedError; + String? get locale; /// The user bio - String? get bio => throw _privateConstructorUsedError; + String? get bio; /// The custom fields linked to your user /// It must match the ones you have created in your reachFive console - Map? get customFields => throw _privateConstructorUsedError; + Map? get customFields; /// The user consents // TODO: find the consents we can put in here - Map? get consents => throw _privateConstructorUsedError; + Map? get consents; /// The time the user's profile was created - String? get createdAt => throw _privateConstructorUsedError; + String? get createdAt; /// The last time the user's profile was updated - String? get updatedAt => throw _privateConstructorUsedError; + String? get updatedAt; /// Used to know if the user profile is lite or not - bool? get liteOnly => throw _privateConstructorUsedError; + bool? get liteOnly; /// The user company - String? get company => throw _privateConstructorUsedError; + String? get company; + + /// Create a copy of Profile + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $ProfileCopyWith get copyWith => + _$ProfileCopyWithImpl(this as Profile, _$identity); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is Profile && + (identical(other.uid, uid) || other.uid == uid) && + (identical(other.givenName, givenName) || + other.givenName == givenName) && + (identical(other.middleName, middleName) || + other.middleName == middleName) && + (identical(other.familyName, familyName) || + other.familyName == familyName) && + (identical(other.name, name) || other.name == name) && + (identical(other.nickname, nickname) || + other.nickname == nickname) && + (identical(other.birthdate, birthdate) || + other.birthdate == birthdate) && + (identical(other.profileURL, profileURL) || + other.profileURL == profileURL) && + (identical(other.picture, picture) || other.picture == picture) && + (identical(other.externalId, externalId) || + other.externalId == externalId) && + const DeepCollectionEquality().equals(other.authTypes, authTypes) && + (identical(other.loginSummary, loginSummary) || + other.loginSummary == loginSummary) && + (identical(other.username, username) || + other.username == username) && + (identical(other.gender, gender) || other.gender == gender) && + (identical(other.email, email) || other.email == email) && + (identical(other.emailVerified, emailVerified) || + other.emailVerified == emailVerified) && + (identical(other.emails, emails) || other.emails == emails) && + (identical(other.phoneNumber, phoneNumber) || + other.phoneNumber == phoneNumber) && + (identical(other.phoneNumberVerified, phoneNumberVerified) || + other.phoneNumberVerified == phoneNumberVerified) && + const DeepCollectionEquality().equals(other.addresses, addresses) && + (identical(other.locale, locale) || other.locale == locale) && + (identical(other.bio, bio) || other.bio == bio) && + const DeepCollectionEquality() + .equals(other.customFields, customFields) && + const DeepCollectionEquality().equals(other.consents, consents) && + (identical(other.createdAt, createdAt) || + other.createdAt == createdAt) && + (identical(other.updatedAt, updatedAt) || + other.updatedAt == updatedAt) && + (identical(other.liteOnly, liteOnly) || + other.liteOnly == liteOnly) && + (identical(other.company, company) || other.company == company)); + } + + @override + int get hashCode => Object.hashAll([ + runtimeType, + uid, + givenName, + middleName, + familyName, + name, + nickname, + birthdate, + profileURL, + picture, + externalId, + const DeepCollectionEquality().hash(authTypes), + loginSummary, + username, + gender, + email, + emailVerified, + emails, + phoneNumber, + phoneNumberVerified, + const DeepCollectionEquality().hash(addresses), + locale, + bio, + const DeepCollectionEquality().hash(customFields), + const DeepCollectionEquality().hash(consents), + createdAt, + updatedAt, + liteOnly, + company + ]); - @JsonKey(ignore: true) - $ProfileCopyWith get copyWith => throw _privateConstructorUsedError; + @override + String toString() { + return 'Profile(uid: $uid, givenName: $givenName, middleName: $middleName, familyName: $familyName, name: $name, nickname: $nickname, birthdate: $birthdate, profileURL: $profileURL, picture: $picture, externalId: $externalId, authTypes: $authTypes, loginSummary: $loginSummary, username: $username, gender: $gender, email: $email, emailVerified: $emailVerified, emails: $emails, phoneNumber: $phoneNumber, phoneNumberVerified: $phoneNumberVerified, addresses: $addresses, locale: $locale, bio: $bio, customFields: $customFields, consents: $consents, createdAt: $createdAt, updatedAt: $updatedAt, liteOnly: $liteOnly, company: $company)'; + } } /// @nodoc -abstract class $ProfileCopyWith<$Res> { - factory $ProfileCopyWith(Profile value, $Res Function(Profile) then) = - _$ProfileCopyWithImpl<$Res, Profile>; +abstract mixin class $ProfileCopyWith<$Res> { + factory $ProfileCopyWith(Profile value, $Res Function(Profile) _then) = + _$ProfileCopyWithImpl; @useResult $Res call( {String? uid, @@ -143,15 +234,14 @@ abstract class $ProfileCopyWith<$Res> { } /// @nodoc -class _$ProfileCopyWithImpl<$Res, $Val extends Profile> - implements $ProfileCopyWith<$Res> { - _$ProfileCopyWithImpl(this._value, this._then); +class _$ProfileCopyWithImpl<$Res> implements $ProfileCopyWith<$Res> { + _$ProfileCopyWithImpl(this._self, this._then); - // ignore: unused_field - final $Val _value; - // ignore: unused_field - final $Res Function($Val) _then; + final Profile _self; + final $Res Function(Profile) _then; + /// Create a copy of Profile + /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') @override $Res call({ @@ -184,355 +274,489 @@ class _$ProfileCopyWithImpl<$Res, $Val extends Profile> Object? liteOnly = freezed, Object? company = freezed, }) { - return _then(_value.copyWith( + return _then(_self.copyWith( uid: freezed == uid - ? _value.uid + ? _self.uid : uid // ignore: cast_nullable_to_non_nullable as String?, givenName: freezed == givenName - ? _value.givenName + ? _self.givenName : givenName // ignore: cast_nullable_to_non_nullable as String?, middleName: freezed == middleName - ? _value.middleName + ? _self.middleName : middleName // ignore: cast_nullable_to_non_nullable as String?, familyName: freezed == familyName - ? _value.familyName + ? _self.familyName : familyName // ignore: cast_nullable_to_non_nullable as String?, name: freezed == name - ? _value.name + ? _self.name : name // ignore: cast_nullable_to_non_nullable as String?, nickname: freezed == nickname - ? _value.nickname + ? _self.nickname : nickname // ignore: cast_nullable_to_non_nullable as String?, birthdate: freezed == birthdate - ? _value.birthdate + ? _self.birthdate : birthdate // ignore: cast_nullable_to_non_nullable as String?, profileURL: freezed == profileURL - ? _value.profileURL + ? _self.profileURL : profileURL // ignore: cast_nullable_to_non_nullable as String?, picture: freezed == picture - ? _value.picture + ? _self.picture : picture // ignore: cast_nullable_to_non_nullable as String?, externalId: freezed == externalId - ? _value.externalId + ? _self.externalId : externalId // ignore: cast_nullable_to_non_nullable as String?, authTypes: freezed == authTypes - ? _value.authTypes + ? _self.authTypes : authTypes // ignore: cast_nullable_to_non_nullable as List?, loginSummary: freezed == loginSummary - ? _value.loginSummary + ? _self.loginSummary : loginSummary // ignore: cast_nullable_to_non_nullable as LoginSummary?, username: freezed == username - ? _value.username + ? _self.username : username // ignore: cast_nullable_to_non_nullable as String?, gender: freezed == gender - ? _value.gender + ? _self.gender : gender // ignore: cast_nullable_to_non_nullable as String?, email: freezed == email - ? _value.email + ? _self.email : email // ignore: cast_nullable_to_non_nullable as String?, emailVerified: freezed == emailVerified - ? _value.emailVerified + ? _self.emailVerified : emailVerified // ignore: cast_nullable_to_non_nullable as bool?, emails: freezed == emails - ? _value.emails + ? _self.emails : emails // ignore: cast_nullable_to_non_nullable as Emails?, phoneNumber: freezed == phoneNumber - ? _value.phoneNumber + ? _self.phoneNumber : phoneNumber // ignore: cast_nullable_to_non_nullable as String?, phoneNumberVerified: freezed == phoneNumberVerified - ? _value.phoneNumberVerified + ? _self.phoneNumberVerified : phoneNumberVerified // ignore: cast_nullable_to_non_nullable as bool?, addresses: freezed == addresses - ? _value.addresses + ? _self.addresses : addresses // ignore: cast_nullable_to_non_nullable as List?, locale: freezed == locale - ? _value.locale + ? _self.locale : locale // ignore: cast_nullable_to_non_nullable as String?, bio: freezed == bio - ? _value.bio + ? _self.bio : bio // ignore: cast_nullable_to_non_nullable as String?, customFields: freezed == customFields - ? _value.customFields + ? _self.customFields : customFields // ignore: cast_nullable_to_non_nullable as Map?, consents: freezed == consents - ? _value.consents + ? _self.consents : consents // ignore: cast_nullable_to_non_nullable as Map?, createdAt: freezed == createdAt - ? _value.createdAt + ? _self.createdAt : createdAt // ignore: cast_nullable_to_non_nullable as String?, updatedAt: freezed == updatedAt - ? _value.updatedAt + ? _self.updatedAt : updatedAt // ignore: cast_nullable_to_non_nullable as String?, liteOnly: freezed == liteOnly - ? _value.liteOnly + ? _self.liteOnly : liteOnly // ignore: cast_nullable_to_non_nullable as bool?, company: freezed == company - ? _value.company + ? _self.company : company // ignore: cast_nullable_to_non_nullable as String?, - ) as $Val); + )); } } -/// @nodoc -abstract class _$$_ProfileCopyWith<$Res> implements $ProfileCopyWith<$Res> { - factory _$$_ProfileCopyWith( - _$_Profile value, $Res Function(_$_Profile) then) = - __$$_ProfileCopyWithImpl<$Res>; - @override - @useResult - $Res call( - {String? uid, - String? givenName, - String? middleName, - String? familyName, - String? name, - String? nickname, - String? birthdate, - String? profileURL, - String? picture, - String? externalId, - List? authTypes, - LoginSummary? loginSummary, - String? username, - String? gender, - String? email, - bool? emailVerified, - Emails? emails, - String? phoneNumber, - bool? phoneNumberVerified, - List? addresses, - String? locale, - String? bio, - Map? customFields, - Map? consents, - String? createdAt, - String? updatedAt, - bool? liteOnly, - String? company}); +/// Adds pattern-matching-related methods to [Profile]. +extension ProfilePatterns on Profile { + /// 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(_Profile value)? $default, { + required TResult orElse(), + }) { + final _that = this; + switch (_that) { + case _Profile() 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(_Profile value) $default, + ) { + final _that = this; + switch (_that) { + case _Profile(): + 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(_Profile value)? $default, + ) { + final _that = this; + switch (_that) { + case _Profile() 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? uid, + String? givenName, + String? middleName, + String? familyName, + String? name, + String? nickname, + String? birthdate, + String? profileURL, + String? picture, + String? externalId, + List? authTypes, + LoginSummary? loginSummary, + String? username, + String? gender, + String? email, + bool? emailVerified, + Emails? emails, + String? phoneNumber, + bool? phoneNumberVerified, + List? addresses, + String? locale, + String? bio, + Map? customFields, + Map? consents, + String? createdAt, + String? updatedAt, + bool? liteOnly, + String? company)? + $default, { + required TResult orElse(), + }) { + final _that = this; + switch (_that) { + case _Profile() when $default != null: + return $default( + _that.uid, + _that.givenName, + _that.middleName, + _that.familyName, + _that.name, + _that.nickname, + _that.birthdate, + _that.profileURL, + _that.picture, + _that.externalId, + _that.authTypes, + _that.loginSummary, + _that.username, + _that.gender, + _that.email, + _that.emailVerified, + _that.emails, + _that.phoneNumber, + _that.phoneNumberVerified, + _that.addresses, + _that.locale, + _that.bio, + _that.customFields, + _that.consents, + _that.createdAt, + _that.updatedAt, + _that.liteOnly, + _that.company); + 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? uid, + String? givenName, + String? middleName, + String? familyName, + String? name, + String? nickname, + String? birthdate, + String? profileURL, + String? picture, + String? externalId, + List? authTypes, + LoginSummary? loginSummary, + String? username, + String? gender, + String? email, + bool? emailVerified, + Emails? emails, + String? phoneNumber, + bool? phoneNumberVerified, + List? addresses, + String? locale, + String? bio, + Map? customFields, + Map? consents, + String? createdAt, + String? updatedAt, + bool? liteOnly, + String? company) + $default, + ) { + final _that = this; + switch (_that) { + case _Profile(): + return $default( + _that.uid, + _that.givenName, + _that.middleName, + _that.familyName, + _that.name, + _that.nickname, + _that.birthdate, + _that.profileURL, + _that.picture, + _that.externalId, + _that.authTypes, + _that.loginSummary, + _that.username, + _that.gender, + _that.email, + _that.emailVerified, + _that.emails, + _that.phoneNumber, + _that.phoneNumberVerified, + _that.addresses, + _that.locale, + _that.bio, + _that.customFields, + _that.consents, + _that.createdAt, + _that.updatedAt, + _that.liteOnly, + _that.company); + 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? uid, + String? givenName, + String? middleName, + String? familyName, + String? name, + String? nickname, + String? birthdate, + String? profileURL, + String? picture, + String? externalId, + List? authTypes, + LoginSummary? loginSummary, + String? username, + String? gender, + String? email, + bool? emailVerified, + Emails? emails, + String? phoneNumber, + bool? phoneNumberVerified, + List? addresses, + String? locale, + String? bio, + Map? customFields, + Map? consents, + String? createdAt, + String? updatedAt, + bool? liteOnly, + String? company)? + $default, + ) { + final _that = this; + switch (_that) { + case _Profile() when $default != null: + return $default( + _that.uid, + _that.givenName, + _that.middleName, + _that.familyName, + _that.name, + _that.nickname, + _that.birthdate, + _that.profileURL, + _that.picture, + _that.externalId, + _that.authTypes, + _that.loginSummary, + _that.username, + _that.gender, + _that.email, + _that.emailVerified, + _that.emails, + _that.phoneNumber, + _that.phoneNumberVerified, + _that.addresses, + _that.locale, + _that.bio, + _that.customFields, + _that.consents, + _that.createdAt, + _that.updatedAt, + _that.liteOnly, + _that.company); + case _: + return null; + } + } } /// @nodoc -class __$$_ProfileCopyWithImpl<$Res> - extends _$ProfileCopyWithImpl<$Res, _$_Profile> - implements _$$_ProfileCopyWith<$Res> { - __$$_ProfileCopyWithImpl(_$_Profile _value, $Res Function(_$_Profile) _then) - : super(_value, _then); - @pragma('vm:prefer-inline') - @override - $Res call({ - Object? uid = freezed, - Object? givenName = freezed, - Object? middleName = freezed, - Object? familyName = freezed, - Object? name = freezed, - Object? nickname = freezed, - Object? birthdate = freezed, - Object? profileURL = freezed, - Object? picture = freezed, - Object? externalId = freezed, - Object? authTypes = freezed, - Object? loginSummary = freezed, - Object? username = freezed, - Object? gender = freezed, - Object? email = freezed, - Object? emailVerified = freezed, - Object? emails = freezed, - Object? phoneNumber = freezed, - Object? phoneNumberVerified = freezed, - Object? addresses = freezed, - Object? locale = freezed, - Object? bio = freezed, - Object? customFields = freezed, - Object? consents = freezed, - Object? createdAt = freezed, - Object? updatedAt = freezed, - Object? liteOnly = freezed, - Object? company = freezed, - }) { - return _then(_$_Profile( - uid: freezed == uid - ? _value.uid - : uid // ignore: cast_nullable_to_non_nullable - as String?, - givenName: freezed == givenName - ? _value.givenName - : givenName // ignore: cast_nullable_to_non_nullable - as String?, - middleName: freezed == middleName - ? _value.middleName - : middleName // ignore: cast_nullable_to_non_nullable - as String?, - familyName: freezed == familyName - ? _value.familyName - : familyName // ignore: cast_nullable_to_non_nullable - as String?, - name: freezed == name - ? _value.name - : name // ignore: cast_nullable_to_non_nullable - as String?, - nickname: freezed == nickname - ? _value.nickname - : nickname // ignore: cast_nullable_to_non_nullable - as String?, - birthdate: freezed == birthdate - ? _value.birthdate - : birthdate // ignore: cast_nullable_to_non_nullable - as String?, - profileURL: freezed == profileURL - ? _value.profileURL - : profileURL // ignore: cast_nullable_to_non_nullable - as String?, - picture: freezed == picture - ? _value.picture - : picture // ignore: cast_nullable_to_non_nullable - as String?, - externalId: freezed == externalId - ? _value.externalId - : externalId // ignore: cast_nullable_to_non_nullable - as String?, - authTypes: freezed == authTypes - ? _value._authTypes - : authTypes // ignore: cast_nullable_to_non_nullable - as List?, - loginSummary: freezed == loginSummary - ? _value.loginSummary - : loginSummary // ignore: cast_nullable_to_non_nullable - as LoginSummary?, - username: freezed == username - ? _value.username - : username // ignore: cast_nullable_to_non_nullable - as String?, - gender: freezed == gender - ? _value.gender - : gender // ignore: cast_nullable_to_non_nullable - as String?, - email: freezed == email - ? _value.email - : email // ignore: cast_nullable_to_non_nullable - as String?, - emailVerified: freezed == emailVerified - ? _value.emailVerified - : emailVerified // ignore: cast_nullable_to_non_nullable - as bool?, - emails: freezed == emails - ? _value.emails - : emails // ignore: cast_nullable_to_non_nullable - as Emails?, - phoneNumber: freezed == phoneNumber - ? _value.phoneNumber - : phoneNumber // ignore: cast_nullable_to_non_nullable - as String?, - phoneNumberVerified: freezed == phoneNumberVerified - ? _value.phoneNumberVerified - : phoneNumberVerified // ignore: cast_nullable_to_non_nullable - as bool?, - addresses: freezed == addresses - ? _value._addresses - : addresses // ignore: cast_nullable_to_non_nullable - as List?, - locale: freezed == locale - ? _value.locale - : locale // ignore: cast_nullable_to_non_nullable - as String?, - bio: freezed == bio - ? _value.bio - : bio // ignore: cast_nullable_to_non_nullable - as String?, - customFields: freezed == customFields - ? _value._customFields - : customFields // ignore: cast_nullable_to_non_nullable - as Map?, - consents: freezed == consents - ? _value._consents - : consents // ignore: cast_nullable_to_non_nullable - as Map?, - createdAt: freezed == createdAt - ? _value.createdAt - : createdAt // ignore: cast_nullable_to_non_nullable - as String?, - updatedAt: freezed == updatedAt - ? _value.updatedAt - : updatedAt // ignore: cast_nullable_to_non_nullable - as String?, - liteOnly: freezed == liteOnly - ? _value.liteOnly - : liteOnly // ignore: cast_nullable_to_non_nullable - as bool?, - company: freezed == company - ? _value.company - : company // ignore: cast_nullable_to_non_nullable - as String?, - )); - } -} - -/// @nodoc - -class _$_Profile implements _Profile { - const _$_Profile( - {this.uid, - this.givenName, - this.middleName, - this.familyName, - this.name, - this.nickname, - this.birthdate, - this.profileURL, - this.picture, - this.externalId, - final List? authTypes, - this.loginSummary, - this.username, - this.gender, - this.email, - this.emailVerified, - this.emails, - this.phoneNumber, - this.phoneNumberVerified, - final List? addresses, - this.locale, - this.bio, - final Map? customFields, - final Map? consents, - this.createdAt, - this.updatedAt, - this.liteOnly, - this.company}) - : _authTypes = authTypes, - _addresses = addresses, - _customFields = customFields, - _consents = consents; - - /// The user id +class _Profile implements Profile { + const _Profile( + {this.uid, + this.givenName, + this.middleName, + this.familyName, + this.name, + this.nickname, + this.birthdate, + this.profileURL, + this.picture, + this.externalId, + final List? authTypes, + this.loginSummary, + this.username, + this.gender, + this.email, + this.emailVerified, + this.emails, + this.phoneNumber, + this.phoneNumberVerified, + final List? addresses, + this.locale, + this.bio, + final Map? customFields, + final Map? consents, + this.createdAt, + this.updatedAt, + this.liteOnly, + this.company}) + : _authTypes = authTypes, + _addresses = addresses, + _customFields = customFields, + _consents = consents; + + /// The user id @override final String? uid; @@ -684,16 +908,19 @@ class _$_Profile implements _Profile { @override final String? company; + /// Create a copy of Profile + /// with the given fields replaced by the non-null parameter values. @override - String toString() { - return 'Profile(uid: $uid, givenName: $givenName, middleName: $middleName, familyName: $familyName, name: $name, nickname: $nickname, birthdate: $birthdate, profileURL: $profileURL, picture: $picture, externalId: $externalId, authTypes: $authTypes, loginSummary: $loginSummary, username: $username, gender: $gender, email: $email, emailVerified: $emailVerified, emails: $emails, phoneNumber: $phoneNumber, phoneNumberVerified: $phoneNumberVerified, addresses: $addresses, locale: $locale, bio: $bio, customFields: $customFields, consents: $consents, createdAt: $createdAt, updatedAt: $updatedAt, liteOnly: $liteOnly, company: $company)'; - } + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + _$ProfileCopyWith<_Profile> get copyWith => + __$ProfileCopyWithImpl<_Profile>(this, _$identity); @override - bool operator ==(dynamic other) { + bool operator ==(Object other) { return identical(this, other) || (other.runtimeType == runtimeType && - other is _$_Profile && + other is _Profile && (identical(other.uid, uid) || other.uid == uid) && (identical(other.givenName, givenName) || other.givenName == givenName) && @@ -775,160 +1002,205 @@ class _$_Profile implements _Profile { company ]); - @JsonKey(ignore: true) @override - @pragma('vm:prefer-inline') - _$$_ProfileCopyWith<_$_Profile> get copyWith => - __$$_ProfileCopyWithImpl<_$_Profile>(this, _$identity); + String toString() { + return 'Profile(uid: $uid, givenName: $givenName, middleName: $middleName, familyName: $familyName, name: $name, nickname: $nickname, birthdate: $birthdate, profileURL: $profileURL, picture: $picture, externalId: $externalId, authTypes: $authTypes, loginSummary: $loginSummary, username: $username, gender: $gender, email: $email, emailVerified: $emailVerified, emails: $emails, phoneNumber: $phoneNumber, phoneNumberVerified: $phoneNumberVerified, addresses: $addresses, locale: $locale, bio: $bio, customFields: $customFields, consents: $consents, createdAt: $createdAt, updatedAt: $updatedAt, liteOnly: $liteOnly, company: $company)'; + } } -abstract class _Profile implements Profile { - const factory _Profile( - {final String? uid, - final String? givenName, - final String? middleName, - final String? familyName, - final String? name, - final String? nickname, - final String? birthdate, - final String? profileURL, - final String? picture, - final String? externalId, - final List? authTypes, - final LoginSummary? loginSummary, - final String? username, - final String? gender, - final String? email, - final bool? emailVerified, - final Emails? emails, - final String? phoneNumber, - final bool? phoneNumberVerified, - final List? addresses, - final String? locale, - final String? bio, - final Map? customFields, - final Map? consents, - final String? createdAt, - final String? updatedAt, - final bool? liteOnly, - final String? company}) = _$_Profile; - - @override - - /// The user id - String? get uid; - @override - - /// The user given name - String? get givenName; - @override - - /// The user middle name - String? get middleName; - @override - - /// The user family name - String? get familyName; - @override - - /// The user name - String? get name; - @override - - /// The user nickname - String? get nickname; - @override - - /// The user birthdate - String? get birthdate; - @override - - /// The user profile url - String? get profileURL; - @override - - /// The user picture - String? get picture; - @override - - /// The user external id - String? get externalId; - @override - - /// The user list of authentication types - List? get authTypes; - @override - - /// The user [LoginSummary] - LoginSummary? get loginSummary; - @override - - /// The user username - String? get username; - @override - - /// The user gender - String? get gender; - @override - - /// The user email - String? get email; - @override - - /// Used to check if an user [email] is verified or not - bool? get emailVerified; - @override - - /// The user list of verified/unverified emails - Emails? get emails; - @override - - /// The user phone number - String? get phoneNumber; - @override - - /// Used to check if an user [phoneNumber] is verified or not - bool? get phoneNumberVerified; - @override - - /// The user list of addresses - List? get addresses; - @override - - /// The user locale - String? get locale; - @override - - /// The user bio - String? get bio; - @override - - /// The custom fields linked to your user - /// It must match the ones you have created in your reachFive console - Map? get customFields; - @override - - /// The user consents -// TODO: find the consents we can put in here - Map? get consents; - @override - - /// The time the user's profile was created - String? get createdAt; +/// @nodoc +abstract mixin class _$ProfileCopyWith<$Res> implements $ProfileCopyWith<$Res> { + factory _$ProfileCopyWith(_Profile value, $Res Function(_Profile) _then) = + __$ProfileCopyWithImpl; @override + @useResult + $Res call( + {String? uid, + String? givenName, + String? middleName, + String? familyName, + String? name, + String? nickname, + String? birthdate, + String? profileURL, + String? picture, + String? externalId, + List? authTypes, + LoginSummary? loginSummary, + String? username, + String? gender, + String? email, + bool? emailVerified, + Emails? emails, + String? phoneNumber, + bool? phoneNumberVerified, + List? addresses, + String? locale, + String? bio, + Map? customFields, + Map? consents, + String? createdAt, + String? updatedAt, + bool? liteOnly, + String? company}); +} - /// The last time the user's profile was updated - String? get updatedAt; - @override +/// @nodoc +class __$ProfileCopyWithImpl<$Res> implements _$ProfileCopyWith<$Res> { + __$ProfileCopyWithImpl(this._self, this._then); - /// Used to know if the user profile is lite or not - bool? get liteOnly; - @override + final _Profile _self; + final $Res Function(_Profile) _then; - /// The user company - String? get company; + /// Create a copy of Profile + /// with the given fields replaced by the non-null parameter values. @override - @JsonKey(ignore: true) - _$$_ProfileCopyWith<_$_Profile> get copyWith => - throw _privateConstructorUsedError; + @pragma('vm:prefer-inline') + $Res call({ + Object? uid = freezed, + Object? givenName = freezed, + Object? middleName = freezed, + Object? familyName = freezed, + Object? name = freezed, + Object? nickname = freezed, + Object? birthdate = freezed, + Object? profileURL = freezed, + Object? picture = freezed, + Object? externalId = freezed, + Object? authTypes = freezed, + Object? loginSummary = freezed, + Object? username = freezed, + Object? gender = freezed, + Object? email = freezed, + Object? emailVerified = freezed, + Object? emails = freezed, + Object? phoneNumber = freezed, + Object? phoneNumberVerified = freezed, + Object? addresses = freezed, + Object? locale = freezed, + Object? bio = freezed, + Object? customFields = freezed, + Object? consents = freezed, + Object? createdAt = freezed, + Object? updatedAt = freezed, + Object? liteOnly = freezed, + Object? company = freezed, + }) { + return _then(_Profile( + uid: freezed == uid + ? _self.uid + : uid // ignore: cast_nullable_to_non_nullable + as String?, + givenName: freezed == givenName + ? _self.givenName + : givenName // ignore: cast_nullable_to_non_nullable + as String?, + middleName: freezed == middleName + ? _self.middleName + : middleName // ignore: cast_nullable_to_non_nullable + as String?, + familyName: freezed == familyName + ? _self.familyName + : familyName // ignore: cast_nullable_to_non_nullable + as String?, + name: freezed == name + ? _self.name + : name // ignore: cast_nullable_to_non_nullable + as String?, + nickname: freezed == nickname + ? _self.nickname + : nickname // ignore: cast_nullable_to_non_nullable + as String?, + birthdate: freezed == birthdate + ? _self.birthdate + : birthdate // ignore: cast_nullable_to_non_nullable + as String?, + profileURL: freezed == profileURL + ? _self.profileURL + : profileURL // ignore: cast_nullable_to_non_nullable + as String?, + picture: freezed == picture + ? _self.picture + : picture // ignore: cast_nullable_to_non_nullable + as String?, + externalId: freezed == externalId + ? _self.externalId + : externalId // ignore: cast_nullable_to_non_nullable + as String?, + authTypes: freezed == authTypes + ? _self._authTypes + : authTypes // ignore: cast_nullable_to_non_nullable + as List?, + loginSummary: freezed == loginSummary + ? _self.loginSummary + : loginSummary // ignore: cast_nullable_to_non_nullable + as LoginSummary?, + username: freezed == username + ? _self.username + : username // ignore: cast_nullable_to_non_nullable + as String?, + gender: freezed == gender + ? _self.gender + : gender // ignore: cast_nullable_to_non_nullable + as String?, + email: freezed == email + ? _self.email + : email // ignore: cast_nullable_to_non_nullable + as String?, + emailVerified: freezed == emailVerified + ? _self.emailVerified + : emailVerified // ignore: cast_nullable_to_non_nullable + as bool?, + emails: freezed == emails + ? _self.emails + : emails // ignore: cast_nullable_to_non_nullable + as Emails?, + phoneNumber: freezed == phoneNumber + ? _self.phoneNumber + : phoneNumber // ignore: cast_nullable_to_non_nullable + as String?, + phoneNumberVerified: freezed == phoneNumberVerified + ? _self.phoneNumberVerified + : phoneNumberVerified // ignore: cast_nullable_to_non_nullable + as bool?, + addresses: freezed == addresses + ? _self._addresses + : addresses // ignore: cast_nullable_to_non_nullable + as List?, + locale: freezed == locale + ? _self.locale + : locale // ignore: cast_nullable_to_non_nullable + as String?, + bio: freezed == bio + ? _self.bio + : bio // ignore: cast_nullable_to_non_nullable + as String?, + customFields: freezed == customFields + ? _self._customFields + : customFields // ignore: cast_nullable_to_non_nullable + as Map?, + consents: freezed == consents + ? _self._consents + : consents // ignore: cast_nullable_to_non_nullable + as Map?, + createdAt: freezed == createdAt + ? _self.createdAt + : createdAt // ignore: cast_nullable_to_non_nullable + as String?, + updatedAt: freezed == updatedAt + ? _self.updatedAt + : updatedAt // ignore: cast_nullable_to_non_nullable + as String?, + liteOnly: freezed == liteOnly + ? _self.liteOnly + : liteOnly // ignore: cast_nullable_to_non_nullable + as bool?, + company: freezed == company + ? _self.company + : company // ignore: cast_nullable_to_non_nullable + as String?, + )); + } } + +// dart format on diff --git a/flutter_reach_five/lib/models/revoke_token_type.dart b/flutter_reach_five/lib/models/revoke_token_type.dart index 961f623..3815826 100644 --- a/flutter_reach_five/lib/models/revoke_token_type.dart +++ b/flutter_reach_five/lib/models/revoke_token_type.dart @@ -7,9 +7,14 @@ enum RevokeTokenType { access } +// coverage:ignore-start /// Map extension on the RevokeTokenType enum +@Deprecated('Replace with Dart >=3 pattern matching using a switch statement.') extension RevokeTokenTypeMap on RevokeTokenType { /// map method for the RevokeTokenType enum + @Deprecated( + 'Replace with Dart >=3 pattern matching using a switch statement.', + ) T map({required T refresh, required T access}) { switch (this) { case RevokeTokenType.refresh: @@ -19,3 +24,4 @@ extension RevokeTokenTypeMap on RevokeTokenType { } } } +// coverage:ignore-end diff --git a/flutter_reach_five/lib/models/update_password_request.dart b/flutter_reach_five/lib/models/update_password_request.dart index 7bea25d..92f2af8 100644 --- a/flutter_reach_five/lib/models/update_password_request.dart +++ b/flutter_reach_five/lib/models/update_password_request.dart @@ -7,7 +7,7 @@ part 'update_password_request.freezed.dart'; @freezed /// Update password request -class UpdatePasswordRequest with _$UpdatePasswordRequest { +sealed class UpdatePasswordRequest with _$UpdatePasswordRequest { /// Update password request model using an access token and the old password const factory UpdatePasswordRequest.withAccessToken({ required AuthToken authToken, diff --git a/flutter_reach_five/lib/models/update_password_request.freezed.dart b/flutter_reach_five/lib/models/update_password_request.freezed.dart index 2f4acd8..e06fa89 100644 --- a/flutter_reach_five/lib/models/update_password_request.freezed.dart +++ b/flutter_reach_five/lib/models/update_password_request.freezed.dart @@ -1,5 +1,5 @@ -// 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 @@ -9,262 +9,199 @@ part of 'update_password_request.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#custom-getters-and-methods'); - /// @nodoc mixin _$UpdatePasswordRequest { - String get newPassword => throw _privateConstructorUsedError; - @optionalTypeArgs - TResult when({ - required TResult Function( - AuthToken authToken, String oldPassword, String newPassword) - withAccessToken, - required TResult Function(AuthToken freshAuthToken, String newPassword) - withFreshAccessToken, - required TResult Function( - String email, String verificationCode, String newPassword) - withEmail, - required TResult Function( - String phoneNumber, String verificationCode, String newPassword) - withPhoneNumber, - }) => - throw _privateConstructorUsedError; - @optionalTypeArgs - TResult? whenOrNull({ - TResult? Function( - AuthToken authToken, String oldPassword, String newPassword)? - withAccessToken, - TResult? Function(AuthToken freshAuthToken, String newPassword)? - withFreshAccessToken, - TResult? Function( - String email, String verificationCode, String newPassword)? - withEmail, - TResult? Function( - String phoneNumber, String verificationCode, String newPassword)? - withPhoneNumber, - }) => - throw _privateConstructorUsedError; - @optionalTypeArgs - TResult maybeWhen({ - TResult Function( - AuthToken authToken, String oldPassword, String newPassword)? - withAccessToken, - TResult Function(AuthToken freshAuthToken, String newPassword)? - withFreshAccessToken, - TResult Function(String email, String verificationCode, String newPassword)? - withEmail, - TResult Function( - String phoneNumber, String verificationCode, String newPassword)? - withPhoneNumber, - required TResult orElse(), - }) => - throw _privateConstructorUsedError; - @optionalTypeArgs - TResult map({ - required TResult Function(UpdatePasswordRequestWithAccessToken value) - withAccessToken, - required TResult Function(UpdatePasswordRequestWithFreshAccessToken value) - withFreshAccessToken, - required TResult Function(UpdatePasswordRequestWithEmail value) withEmail, - required TResult Function(UpdatePasswordRequestWithPhoneNumber value) - withPhoneNumber, - }) => - throw _privateConstructorUsedError; - @optionalTypeArgs - TResult? mapOrNull({ - TResult? Function(UpdatePasswordRequestWithAccessToken value)? - withAccessToken, - TResult? Function(UpdatePasswordRequestWithFreshAccessToken value)? - withFreshAccessToken, - TResult? Function(UpdatePasswordRequestWithEmail value)? withEmail, - TResult? Function(UpdatePasswordRequestWithPhoneNumber value)? - withPhoneNumber, - }) => - throw _privateConstructorUsedError; - @optionalTypeArgs - TResult maybeMap({ - TResult Function(UpdatePasswordRequestWithAccessToken value)? - withAccessToken, - TResult Function(UpdatePasswordRequestWithFreshAccessToken value)? - withFreshAccessToken, - TResult Function(UpdatePasswordRequestWithEmail value)? withEmail, - TResult Function(UpdatePasswordRequestWithPhoneNumber value)? - withPhoneNumber, - required TResult orElse(), - }) => - throw _privateConstructorUsedError; + String get newPassword; - @JsonKey(ignore: true) + /// Create a copy of UpdatePasswordRequest + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') $UpdatePasswordRequestCopyWith get copyWith => - throw _privateConstructorUsedError; -} + _$UpdatePasswordRequestCopyWithImpl( + this as UpdatePasswordRequest, _$identity); -/// @nodoc -abstract class $UpdatePasswordRequestCopyWith<$Res> { - factory $UpdatePasswordRequestCopyWith(UpdatePasswordRequest value, - $Res Function(UpdatePasswordRequest) then) = - _$UpdatePasswordRequestCopyWithImpl<$Res, UpdatePasswordRequest>; - @useResult - $Res call({String newPassword}); -} - -/// @nodoc -class _$UpdatePasswordRequestCopyWithImpl<$Res, - $Val extends UpdatePasswordRequest> - implements $UpdatePasswordRequestCopyWith<$Res> { - _$UpdatePasswordRequestCopyWithImpl(this._value, this._then); + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is UpdatePasswordRequest && + (identical(other.newPassword, newPassword) || + other.newPassword == newPassword)); + } - // ignore: unused_field - final $Val _value; - // ignore: unused_field - final $Res Function($Val) _then; + @override + int get hashCode => Object.hash(runtimeType, newPassword); - @pragma('vm:prefer-inline') @override - $Res call({ - Object? newPassword = null, - }) { - return _then(_value.copyWith( - newPassword: null == newPassword - ? _value.newPassword - : newPassword // ignore: cast_nullable_to_non_nullable - as String, - ) as $Val); + String toString() { + return 'UpdatePasswordRequest(newPassword: $newPassword)'; } } /// @nodoc -abstract class _$$UpdatePasswordRequestWithAccessTokenCopyWith<$Res> - implements $UpdatePasswordRequestCopyWith<$Res> { - factory _$$UpdatePasswordRequestWithAccessTokenCopyWith( - _$UpdatePasswordRequestWithAccessToken value, - $Res Function(_$UpdatePasswordRequestWithAccessToken) then) = - __$$UpdatePasswordRequestWithAccessTokenCopyWithImpl<$Res>; - @override +abstract mixin class $UpdatePasswordRequestCopyWith<$Res> { + factory $UpdatePasswordRequestCopyWith(UpdatePasswordRequest value, + $Res Function(UpdatePasswordRequest) _then) = + _$UpdatePasswordRequestCopyWithImpl; @useResult - $Res call({AuthToken authToken, String oldPassword, String newPassword}); + $Res call({String newPassword}); } /// @nodoc -class __$$UpdatePasswordRequestWithAccessTokenCopyWithImpl<$Res> - extends _$UpdatePasswordRequestCopyWithImpl<$Res, - _$UpdatePasswordRequestWithAccessToken> - implements _$$UpdatePasswordRequestWithAccessTokenCopyWith<$Res> { - __$$UpdatePasswordRequestWithAccessTokenCopyWithImpl( - _$UpdatePasswordRequestWithAccessToken _value, - $Res Function(_$UpdatePasswordRequestWithAccessToken) _then) - : super(_value, _then); +class _$UpdatePasswordRequestCopyWithImpl<$Res> + implements $UpdatePasswordRequestCopyWith<$Res> { + _$UpdatePasswordRequestCopyWithImpl(this._self, this._then); + final UpdatePasswordRequest _self; + final $Res Function(UpdatePasswordRequest) _then; + + /// Create a copy of UpdatePasswordRequest + /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') @override $Res call({ - Object? authToken = null, - Object? oldPassword = null, Object? newPassword = null, }) { - return _then(_$UpdatePasswordRequestWithAccessToken( - authToken: null == authToken - ? _value.authToken - : authToken // ignore: cast_nullable_to_non_nullable - as AuthToken, - oldPassword: null == oldPassword - ? _value.oldPassword - : oldPassword // ignore: cast_nullable_to_non_nullable - as String, + return _then(_self.copyWith( newPassword: null == newPassword - ? _value.newPassword + ? _self.newPassword : newPassword // ignore: cast_nullable_to_non_nullable as String, )); } } -/// @nodoc - -class _$UpdatePasswordRequestWithAccessToken - implements UpdatePasswordRequestWithAccessToken { - const _$UpdatePasswordRequestWithAccessToken( - {required this.authToken, - required this.oldPassword, - required this.newPassword}); - - @override - final AuthToken authToken; - @override - final String oldPassword; - @override - final String newPassword; +/// Adds pattern-matching-related methods to [UpdatePasswordRequest]. +extension UpdatePasswordRequestPatterns on UpdatePasswordRequest { + /// 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(); + /// } + /// ``` - @override - String toString() { - return 'UpdatePasswordRequest.withAccessToken(authToken: $authToken, oldPassword: $oldPassword, newPassword: $newPassword)'; - } - - @override - bool operator ==(dynamic other) { - return identical(this, other) || - (other.runtimeType == runtimeType && - other is _$UpdatePasswordRequestWithAccessToken && - (identical(other.authToken, authToken) || - other.authToken == authToken) && - (identical(other.oldPassword, oldPassword) || - other.oldPassword == oldPassword) && - (identical(other.newPassword, newPassword) || - other.newPassword == newPassword)); + @optionalTypeArgs + TResult maybeMap({ + TResult Function(UpdatePasswordRequestWithAccessToken value)? + withAccessToken, + TResult Function(UpdatePasswordRequestWithFreshAccessToken value)? + withFreshAccessToken, + TResult Function(UpdatePasswordRequestWithEmail value)? withEmail, + TResult Function(UpdatePasswordRequestWithPhoneNumber value)? + withPhoneNumber, + required TResult orElse(), + }) { + final _that = this; + switch (_that) { + case UpdatePasswordRequestWithAccessToken() when withAccessToken != null: + return withAccessToken(_that); + case UpdatePasswordRequestWithFreshAccessToken() + when withFreshAccessToken != null: + return withFreshAccessToken(_that); + case UpdatePasswordRequestWithEmail() when withEmail != null: + return withEmail(_that); + case UpdatePasswordRequestWithPhoneNumber() when withPhoneNumber != null: + return withPhoneNumber(_that); + case _: + return orElse(); + } } - @override - int get hashCode => - Object.hash(runtimeType, authToken, oldPassword, newPassword); - - @JsonKey(ignore: true) - @override - @pragma('vm:prefer-inline') - _$$UpdatePasswordRequestWithAccessTokenCopyWith< - _$UpdatePasswordRequestWithAccessToken> - get copyWith => __$$UpdatePasswordRequestWithAccessTokenCopyWithImpl< - _$UpdatePasswordRequestWithAccessToken>(this, _$identity); + /// 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 ...; + /// } + /// ``` - @override @optionalTypeArgs - TResult when({ - required TResult Function( - AuthToken authToken, String oldPassword, String newPassword) + TResult map({ + required TResult Function(UpdatePasswordRequestWithAccessToken value) withAccessToken, - required TResult Function(AuthToken freshAuthToken, String newPassword) + required TResult Function(UpdatePasswordRequestWithFreshAccessToken value) withFreshAccessToken, - required TResult Function( - String email, String verificationCode, String newPassword) - withEmail, - required TResult Function( - String phoneNumber, String verificationCode, String newPassword) + required TResult Function(UpdatePasswordRequestWithEmail value) withEmail, + required TResult Function(UpdatePasswordRequestWithPhoneNumber value) withPhoneNumber, }) { - return withAccessToken(authToken, oldPassword, newPassword); + final _that = this; + switch (_that) { + case UpdatePasswordRequestWithAccessToken(): + return withAccessToken(_that); + case UpdatePasswordRequestWithFreshAccessToken(): + return withFreshAccessToken(_that); + case UpdatePasswordRequestWithEmail(): + return withEmail(_that); + case UpdatePasswordRequestWithPhoneNumber(): + return withPhoneNumber(_that); + } } - @override + /// 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? whenOrNull({ - TResult? Function( - AuthToken authToken, String oldPassword, String newPassword)? + TResult? mapOrNull({ + TResult? Function(UpdatePasswordRequestWithAccessToken value)? withAccessToken, - TResult? Function(AuthToken freshAuthToken, String newPassword)? + TResult? Function(UpdatePasswordRequestWithFreshAccessToken value)? withFreshAccessToken, - TResult? Function( - String email, String verificationCode, String newPassword)? - withEmail, - TResult? Function( - String phoneNumber, String verificationCode, String newPassword)? + TResult? Function(UpdatePasswordRequestWithEmail value)? withEmail, + TResult? Function(UpdatePasswordRequestWithPhoneNumber value)? withPhoneNumber, }) { - return withAccessToken?.call(authToken, oldPassword, newPassword); + final _that = this; + switch (_that) { + case UpdatePasswordRequestWithAccessToken() when withAccessToken != null: + return withAccessToken(_that); + case UpdatePasswordRequestWithFreshAccessToken() + when withFreshAccessToken != null: + return withFreshAccessToken(_that); + case UpdatePasswordRequestWithEmail() when withEmail != null: + return withEmail(_that); + case UpdatePasswordRequestWithPhoneNumber() when withPhoneNumber != null: + return withPhoneNumber(_that); + case _: + return null; + } } - @override + /// 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( @@ -279,113 +216,200 @@ class _$UpdatePasswordRequestWithAccessToken withPhoneNumber, required TResult orElse(), }) { - if (withAccessToken != null) { - return withAccessToken(authToken, oldPassword, newPassword); + final _that = this; + switch (_that) { + case UpdatePasswordRequestWithAccessToken() when withAccessToken != null: + return withAccessToken( + _that.authToken, _that.oldPassword, _that.newPassword); + case UpdatePasswordRequestWithFreshAccessToken() + when withFreshAccessToken != null: + return withFreshAccessToken(_that.freshAuthToken, _that.newPassword); + case UpdatePasswordRequestWithEmail() when withEmail != null: + return withEmail( + _that.email, _that.verificationCode, _that.newPassword); + case UpdatePasswordRequestWithPhoneNumber() when withPhoneNumber != null: + return withPhoneNumber( + _that.phoneNumber, _that.verificationCode, _that.newPassword); + case _: + return orElse(); } - return orElse(); } - @override - @optionalTypeArgs - TResult map({ - required TResult Function(UpdatePasswordRequestWithAccessToken value) - withAccessToken, - required TResult Function(UpdatePasswordRequestWithFreshAccessToken value) - withFreshAccessToken, - required TResult Function(UpdatePasswordRequestWithEmail value) withEmail, - required TResult Function(UpdatePasswordRequestWithPhoneNumber value) - withPhoneNumber, - }) { - return withAccessToken(this); - } + /// 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 ...; + /// } + /// ``` - @override @optionalTypeArgs - TResult? mapOrNull({ - TResult? Function(UpdatePasswordRequestWithAccessToken value)? + TResult when({ + required TResult Function( + AuthToken authToken, String oldPassword, String newPassword) withAccessToken, - TResult? Function(UpdatePasswordRequestWithFreshAccessToken value)? + required TResult Function(AuthToken freshAuthToken, String newPassword) withFreshAccessToken, - TResult? Function(UpdatePasswordRequestWithEmail value)? withEmail, - TResult? Function(UpdatePasswordRequestWithPhoneNumber value)? + required TResult Function( + String email, String verificationCode, String newPassword) + withEmail, + required TResult Function( + String phoneNumber, String verificationCode, String newPassword) withPhoneNumber, }) { - return withAccessToken?.call(this); + final _that = this; + switch (_that) { + case UpdatePasswordRequestWithAccessToken(): + return withAccessToken( + _that.authToken, _that.oldPassword, _that.newPassword); + case UpdatePasswordRequestWithFreshAccessToken(): + return withFreshAccessToken(_that.freshAuthToken, _that.newPassword); + case UpdatePasswordRequestWithEmail(): + return withEmail( + _that.email, _that.verificationCode, _that.newPassword); + case UpdatePasswordRequestWithPhoneNumber(): + return withPhoneNumber( + _that.phoneNumber, _that.verificationCode, _that.newPassword); + } } - @override + /// 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 maybeMap({ - TResult Function(UpdatePasswordRequestWithAccessToken value)? + TResult? whenOrNull({ + TResult? Function( + AuthToken authToken, String oldPassword, String newPassword)? withAccessToken, - TResult Function(UpdatePasswordRequestWithFreshAccessToken value)? + TResult? Function(AuthToken freshAuthToken, String newPassword)? withFreshAccessToken, - TResult Function(UpdatePasswordRequestWithEmail value)? withEmail, - TResult Function(UpdatePasswordRequestWithPhoneNumber value)? + TResult? Function( + String email, String verificationCode, String newPassword)? + withEmail, + TResult? Function( + String phoneNumber, String verificationCode, String newPassword)? withPhoneNumber, - required TResult orElse(), }) { - if (withAccessToken != null) { - return withAccessToken(this); + final _that = this; + switch (_that) { + case UpdatePasswordRequestWithAccessToken() when withAccessToken != null: + return withAccessToken( + _that.authToken, _that.oldPassword, _that.newPassword); + case UpdatePasswordRequestWithFreshAccessToken() + when withFreshAccessToken != null: + return withFreshAccessToken(_that.freshAuthToken, _that.newPassword); + case UpdatePasswordRequestWithEmail() when withEmail != null: + return withEmail( + _that.email, _that.verificationCode, _that.newPassword); + case UpdatePasswordRequestWithPhoneNumber() when withPhoneNumber != null: + return withPhoneNumber( + _that.phoneNumber, _that.verificationCode, _that.newPassword); + case _: + return null; } - return orElse(); } } -abstract class UpdatePasswordRequestWithAccessToken - implements UpdatePasswordRequest { - const factory UpdatePasswordRequestWithAccessToken( - {required final AuthToken authToken, - required final String oldPassword, - required final String newPassword}) = - _$UpdatePasswordRequestWithAccessToken; +/// @nodoc + +class UpdatePasswordRequestWithAccessToken implements UpdatePasswordRequest { + const UpdatePasswordRequestWithAccessToken( + {required this.authToken, + required this.oldPassword, + required this.newPassword}); - AuthToken get authToken; - String get oldPassword; + final AuthToken authToken; + final String oldPassword; @override - String get newPassword; + final String newPassword; + + /// Create a copy of UpdatePasswordRequest + /// with the given fields replaced by the non-null parameter values. @override - @JsonKey(ignore: true) - _$$UpdatePasswordRequestWithAccessTokenCopyWith< - _$UpdatePasswordRequestWithAccessToken> - get copyWith => throw _privateConstructorUsedError; + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $UpdatePasswordRequestWithAccessTokenCopyWith< + UpdatePasswordRequestWithAccessToken> + get copyWith => _$UpdatePasswordRequestWithAccessTokenCopyWithImpl< + UpdatePasswordRequestWithAccessToken>(this, _$identity); + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is UpdatePasswordRequestWithAccessToken && + (identical(other.authToken, authToken) || + other.authToken == authToken) && + (identical(other.oldPassword, oldPassword) || + other.oldPassword == oldPassword) && + (identical(other.newPassword, newPassword) || + other.newPassword == newPassword)); + } + + @override + int get hashCode => + Object.hash(runtimeType, authToken, oldPassword, newPassword); + + @override + String toString() { + return 'UpdatePasswordRequest.withAccessToken(authToken: $authToken, oldPassword: $oldPassword, newPassword: $newPassword)'; + } } /// @nodoc -abstract class _$$UpdatePasswordRequestWithFreshAccessTokenCopyWith<$Res> +abstract mixin class $UpdatePasswordRequestWithAccessTokenCopyWith<$Res> implements $UpdatePasswordRequestCopyWith<$Res> { - factory _$$UpdatePasswordRequestWithFreshAccessTokenCopyWith( - _$UpdatePasswordRequestWithFreshAccessToken value, - $Res Function(_$UpdatePasswordRequestWithFreshAccessToken) then) = - __$$UpdatePasswordRequestWithFreshAccessTokenCopyWithImpl<$Res>; + factory $UpdatePasswordRequestWithAccessTokenCopyWith( + UpdatePasswordRequestWithAccessToken value, + $Res Function(UpdatePasswordRequestWithAccessToken) _then) = + _$UpdatePasswordRequestWithAccessTokenCopyWithImpl; @override @useResult - $Res call({AuthToken freshAuthToken, String newPassword}); + $Res call({AuthToken authToken, String oldPassword, String newPassword}); } /// @nodoc -class __$$UpdatePasswordRequestWithFreshAccessTokenCopyWithImpl<$Res> - extends _$UpdatePasswordRequestCopyWithImpl<$Res, - _$UpdatePasswordRequestWithFreshAccessToken> - implements _$$UpdatePasswordRequestWithFreshAccessTokenCopyWith<$Res> { - __$$UpdatePasswordRequestWithFreshAccessTokenCopyWithImpl( - _$UpdatePasswordRequestWithFreshAccessToken _value, - $Res Function(_$UpdatePasswordRequestWithFreshAccessToken) _then) - : super(_value, _then); +class _$UpdatePasswordRequestWithAccessTokenCopyWithImpl<$Res> + implements $UpdatePasswordRequestWithAccessTokenCopyWith<$Res> { + _$UpdatePasswordRequestWithAccessTokenCopyWithImpl(this._self, this._then); - @pragma('vm:prefer-inline') + final UpdatePasswordRequestWithAccessToken _self; + final $Res Function(UpdatePasswordRequestWithAccessToken) _then; + + /// Create a copy of UpdatePasswordRequest + /// with the given fields replaced by the non-null parameter values. @override + @pragma('vm:prefer-inline') $Res call({ - Object? freshAuthToken = null, + Object? authToken = null, + Object? oldPassword = null, Object? newPassword = null, }) { - return _then(_$UpdatePasswordRequestWithFreshAccessToken( - freshAuthToken: null == freshAuthToken - ? _value.freshAuthToken - : freshAuthToken // ignore: cast_nullable_to_non_nullable + return _then(UpdatePasswordRequestWithAccessToken( + authToken: null == authToken + ? _self.authToken + : authToken // ignore: cast_nullable_to_non_nullable as AuthToken, + oldPassword: null == oldPassword + ? _self.oldPassword + : oldPassword // ignore: cast_nullable_to_non_nullable + as String, newPassword: null == newPassword - ? _value.newPassword + ? _self.newPassword : newPassword // ignore: cast_nullable_to_non_nullable as String, )); @@ -394,26 +418,30 @@ class __$$UpdatePasswordRequestWithFreshAccessTokenCopyWithImpl<$Res> /// @nodoc -class _$UpdatePasswordRequestWithFreshAccessToken - implements UpdatePasswordRequestWithFreshAccessToken { - const _$UpdatePasswordRequestWithFreshAccessToken( +class UpdatePasswordRequestWithFreshAccessToken + implements UpdatePasswordRequest { + const UpdatePasswordRequestWithFreshAccessToken( {required this.freshAuthToken, required this.newPassword}); - @override final AuthToken freshAuthToken; @override final String newPassword; + /// Create a copy of UpdatePasswordRequest + /// with the given fields replaced by the non-null parameter values. @override - String toString() { - return 'UpdatePasswordRequest.withFreshAccessToken(freshAuthToken: $freshAuthToken, newPassword: $newPassword)'; - } + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $UpdatePasswordRequestWithFreshAccessTokenCopyWith< + UpdatePasswordRequestWithFreshAccessToken> + get copyWith => _$UpdatePasswordRequestWithFreshAccessTokenCopyWithImpl< + UpdatePasswordRequestWithFreshAccessToken>(this, _$identity); @override - bool operator ==(dynamic other) { + bool operator ==(Object other) { return identical(this, other) || (other.runtimeType == runtimeType && - other is _$UpdatePasswordRequestWithFreshAccessToken && + other is UpdatePasswordRequestWithFreshAccessToken && (identical(other.freshAuthToken, freshAuthToken) || other.freshAuthToken == freshAuthToken) && (identical(other.newPassword, newPassword) || @@ -423,175 +451,48 @@ class _$UpdatePasswordRequestWithFreshAccessToken @override int get hashCode => Object.hash(runtimeType, freshAuthToken, newPassword); - @JsonKey(ignore: true) - @override - @pragma('vm:prefer-inline') - _$$UpdatePasswordRequestWithFreshAccessTokenCopyWith< - _$UpdatePasswordRequestWithFreshAccessToken> - get copyWith => __$$UpdatePasswordRequestWithFreshAccessTokenCopyWithImpl< - _$UpdatePasswordRequestWithFreshAccessToken>(this, _$identity); - @override - @optionalTypeArgs - TResult when({ - required TResult Function( - AuthToken authToken, String oldPassword, String newPassword) - withAccessToken, - required TResult Function(AuthToken freshAuthToken, String newPassword) - withFreshAccessToken, - required TResult Function( - String email, String verificationCode, String newPassword) - withEmail, - required TResult Function( - String phoneNumber, String verificationCode, String newPassword) - withPhoneNumber, - }) { - return withFreshAccessToken(freshAuthToken, newPassword); - } - - @override - @optionalTypeArgs - TResult? whenOrNull({ - TResult? Function( - AuthToken authToken, String oldPassword, String newPassword)? - withAccessToken, - TResult? Function(AuthToken freshAuthToken, String newPassword)? - withFreshAccessToken, - TResult? Function( - String email, String verificationCode, String newPassword)? - withEmail, - TResult? Function( - String phoneNumber, String verificationCode, String newPassword)? - withPhoneNumber, - }) { - return withFreshAccessToken?.call(freshAuthToken, newPassword); - } - - @override - @optionalTypeArgs - TResult maybeWhen({ - TResult Function( - AuthToken authToken, String oldPassword, String newPassword)? - withAccessToken, - TResult Function(AuthToken freshAuthToken, String newPassword)? - withFreshAccessToken, - TResult Function(String email, String verificationCode, String newPassword)? - withEmail, - TResult Function( - String phoneNumber, String verificationCode, String newPassword)? - withPhoneNumber, - required TResult orElse(), - }) { - if (withFreshAccessToken != null) { - return withFreshAccessToken(freshAuthToken, newPassword); - } - return orElse(); - } - - @override - @optionalTypeArgs - TResult map({ - required TResult Function(UpdatePasswordRequestWithAccessToken value) - withAccessToken, - required TResult Function(UpdatePasswordRequestWithFreshAccessToken value) - withFreshAccessToken, - required TResult Function(UpdatePasswordRequestWithEmail value) withEmail, - required TResult Function(UpdatePasswordRequestWithPhoneNumber value) - withPhoneNumber, - }) { - return withFreshAccessToken(this); - } - - @override - @optionalTypeArgs - TResult? mapOrNull({ - TResult? Function(UpdatePasswordRequestWithAccessToken value)? - withAccessToken, - TResult? Function(UpdatePasswordRequestWithFreshAccessToken value)? - withFreshAccessToken, - TResult? Function(UpdatePasswordRequestWithEmail value)? withEmail, - TResult? Function(UpdatePasswordRequestWithPhoneNumber value)? - withPhoneNumber, - }) { - return withFreshAccessToken?.call(this); - } - - @override - @optionalTypeArgs - TResult maybeMap({ - TResult Function(UpdatePasswordRequestWithAccessToken value)? - withAccessToken, - TResult Function(UpdatePasswordRequestWithFreshAccessToken value)? - withFreshAccessToken, - TResult Function(UpdatePasswordRequestWithEmail value)? withEmail, - TResult Function(UpdatePasswordRequestWithPhoneNumber value)? - withPhoneNumber, - required TResult orElse(), - }) { - if (withFreshAccessToken != null) { - return withFreshAccessToken(this); - } - return orElse(); + String toString() { + return 'UpdatePasswordRequest.withFreshAccessToken(freshAuthToken: $freshAuthToken, newPassword: $newPassword)'; } } -abstract class UpdatePasswordRequestWithFreshAccessToken - implements UpdatePasswordRequest { - const factory UpdatePasswordRequestWithFreshAccessToken( - {required final AuthToken freshAuthToken, - required final String newPassword}) = - _$UpdatePasswordRequestWithFreshAccessToken; - - AuthToken get freshAuthToken; - @override - String get newPassword; - @override - @JsonKey(ignore: true) - _$$UpdatePasswordRequestWithFreshAccessTokenCopyWith< - _$UpdatePasswordRequestWithFreshAccessToken> - get copyWith => throw _privateConstructorUsedError; -} - /// @nodoc -abstract class _$$UpdatePasswordRequestWithEmailCopyWith<$Res> +abstract mixin class $UpdatePasswordRequestWithFreshAccessTokenCopyWith<$Res> implements $UpdatePasswordRequestCopyWith<$Res> { - factory _$$UpdatePasswordRequestWithEmailCopyWith( - _$UpdatePasswordRequestWithEmail value, - $Res Function(_$UpdatePasswordRequestWithEmail) then) = - __$$UpdatePasswordRequestWithEmailCopyWithImpl<$Res>; + factory $UpdatePasswordRequestWithFreshAccessTokenCopyWith( + UpdatePasswordRequestWithFreshAccessToken value, + $Res Function(UpdatePasswordRequestWithFreshAccessToken) _then) = + _$UpdatePasswordRequestWithFreshAccessTokenCopyWithImpl; @override @useResult - $Res call({String email, String verificationCode, String newPassword}); + $Res call({AuthToken freshAuthToken, String newPassword}); } /// @nodoc -class __$$UpdatePasswordRequestWithEmailCopyWithImpl<$Res> - extends _$UpdatePasswordRequestCopyWithImpl<$Res, - _$UpdatePasswordRequestWithEmail> - implements _$$UpdatePasswordRequestWithEmailCopyWith<$Res> { - __$$UpdatePasswordRequestWithEmailCopyWithImpl( - _$UpdatePasswordRequestWithEmail _value, - $Res Function(_$UpdatePasswordRequestWithEmail) _then) - : super(_value, _then); +class _$UpdatePasswordRequestWithFreshAccessTokenCopyWithImpl<$Res> + implements $UpdatePasswordRequestWithFreshAccessTokenCopyWith<$Res> { + _$UpdatePasswordRequestWithFreshAccessTokenCopyWithImpl( + this._self, this._then); - @pragma('vm:prefer-inline') + final UpdatePasswordRequestWithFreshAccessToken _self; + final $Res Function(UpdatePasswordRequestWithFreshAccessToken) _then; + + /// Create a copy of UpdatePasswordRequest + /// with the given fields replaced by the non-null parameter values. @override + @pragma('vm:prefer-inline') $Res call({ - Object? email = null, - Object? verificationCode = null, + Object? freshAuthToken = null, Object? newPassword = null, }) { - return _then(_$UpdatePasswordRequestWithEmail( - email: null == email - ? _value.email - : email // ignore: cast_nullable_to_non_nullable - as String, - verificationCode: null == verificationCode - ? _value.verificationCode - : verificationCode // ignore: cast_nullable_to_non_nullable - as String, + return _then(UpdatePasswordRequestWithFreshAccessToken( + freshAuthToken: null == freshAuthToken + ? _self.freshAuthToken + : freshAuthToken // ignore: cast_nullable_to_non_nullable + as AuthToken, newPassword: null == newPassword - ? _value.newPassword + ? _self.newPassword : newPassword // ignore: cast_nullable_to_non_nullable as String, )); @@ -600,30 +501,31 @@ class __$$UpdatePasswordRequestWithEmailCopyWithImpl<$Res> /// @nodoc -class _$UpdatePasswordRequestWithEmail - implements UpdatePasswordRequestWithEmail { - const _$UpdatePasswordRequestWithEmail( +class UpdatePasswordRequestWithEmail implements UpdatePasswordRequest { + const UpdatePasswordRequestWithEmail( {required this.email, required this.verificationCode, required this.newPassword}); - @override final String email; - @override final String verificationCode; @override final String newPassword; + /// Create a copy of UpdatePasswordRequest + /// with the given fields replaced by the non-null parameter values. @override - String toString() { - return 'UpdatePasswordRequest.withEmail(email: $email, verificationCode: $verificationCode, newPassword: $newPassword)'; - } + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $UpdatePasswordRequestWithEmailCopyWith + get copyWith => _$UpdatePasswordRequestWithEmailCopyWithImpl< + UpdatePasswordRequestWithEmail>(this, _$identity); @override - bool operator ==(dynamic other) { + bool operator ==(Object other) { return identical(this, other) || (other.runtimeType == runtimeType && - other is _$UpdatePasswordRequestWithEmail && + other is UpdatePasswordRequestWithEmail && (identical(other.email, email) || other.email == email) && (identical(other.verificationCode, verificationCode) || other.verificationCode == verificationCode) && @@ -635,173 +537,52 @@ class _$UpdatePasswordRequestWithEmail int get hashCode => Object.hash(runtimeType, email, verificationCode, newPassword); - @JsonKey(ignore: true) - @override - @pragma('vm:prefer-inline') - _$$UpdatePasswordRequestWithEmailCopyWith<_$UpdatePasswordRequestWithEmail> - get copyWith => __$$UpdatePasswordRequestWithEmailCopyWithImpl< - _$UpdatePasswordRequestWithEmail>(this, _$identity); - - @override - @optionalTypeArgs - TResult when({ - required TResult Function( - AuthToken authToken, String oldPassword, String newPassword) - withAccessToken, - required TResult Function(AuthToken freshAuthToken, String newPassword) - withFreshAccessToken, - required TResult Function( - String email, String verificationCode, String newPassword) - withEmail, - required TResult Function( - String phoneNumber, String verificationCode, String newPassword) - withPhoneNumber, - }) { - return withEmail(email, verificationCode, newPassword); - } - - @override - @optionalTypeArgs - TResult? whenOrNull({ - TResult? Function( - AuthToken authToken, String oldPassword, String newPassword)? - withAccessToken, - TResult? Function(AuthToken freshAuthToken, String newPassword)? - withFreshAccessToken, - TResult? Function( - String email, String verificationCode, String newPassword)? - withEmail, - TResult? Function( - String phoneNumber, String verificationCode, String newPassword)? - withPhoneNumber, - }) { - return withEmail?.call(email, verificationCode, newPassword); - } - - @override - @optionalTypeArgs - TResult maybeWhen({ - TResult Function( - AuthToken authToken, String oldPassword, String newPassword)? - withAccessToken, - TResult Function(AuthToken freshAuthToken, String newPassword)? - withFreshAccessToken, - TResult Function(String email, String verificationCode, String newPassword)? - withEmail, - TResult Function( - String phoneNumber, String verificationCode, String newPassword)? - withPhoneNumber, - required TResult orElse(), - }) { - if (withEmail != null) { - return withEmail(email, verificationCode, newPassword); - } - return orElse(); - } - - @override - @optionalTypeArgs - TResult map({ - required TResult Function(UpdatePasswordRequestWithAccessToken value) - withAccessToken, - required TResult Function(UpdatePasswordRequestWithFreshAccessToken value) - withFreshAccessToken, - required TResult Function(UpdatePasswordRequestWithEmail value) withEmail, - required TResult Function(UpdatePasswordRequestWithPhoneNumber value) - withPhoneNumber, - }) { - return withEmail(this); - } - - @override - @optionalTypeArgs - TResult? mapOrNull({ - TResult? Function(UpdatePasswordRequestWithAccessToken value)? - withAccessToken, - TResult? Function(UpdatePasswordRequestWithFreshAccessToken value)? - withFreshAccessToken, - TResult? Function(UpdatePasswordRequestWithEmail value)? withEmail, - TResult? Function(UpdatePasswordRequestWithPhoneNumber value)? - withPhoneNumber, - }) { - return withEmail?.call(this); - } - @override - @optionalTypeArgs - TResult maybeMap({ - TResult Function(UpdatePasswordRequestWithAccessToken value)? - withAccessToken, - TResult Function(UpdatePasswordRequestWithFreshAccessToken value)? - withFreshAccessToken, - TResult Function(UpdatePasswordRequestWithEmail value)? withEmail, - TResult Function(UpdatePasswordRequestWithPhoneNumber value)? - withPhoneNumber, - required TResult orElse(), - }) { - if (withEmail != null) { - return withEmail(this); - } - return orElse(); + String toString() { + return 'UpdatePasswordRequest.withEmail(email: $email, verificationCode: $verificationCode, newPassword: $newPassword)'; } } -abstract class UpdatePasswordRequestWithEmail implements UpdatePasswordRequest { - const factory UpdatePasswordRequestWithEmail( - {required final String email, - required final String verificationCode, - required final String newPassword}) = _$UpdatePasswordRequestWithEmail; - - String get email; - String get verificationCode; - @override - String get newPassword; - @override - @JsonKey(ignore: true) - _$$UpdatePasswordRequestWithEmailCopyWith<_$UpdatePasswordRequestWithEmail> - get copyWith => throw _privateConstructorUsedError; -} - /// @nodoc -abstract class _$$UpdatePasswordRequestWithPhoneNumberCopyWith<$Res> +abstract mixin class $UpdatePasswordRequestWithEmailCopyWith<$Res> implements $UpdatePasswordRequestCopyWith<$Res> { - factory _$$UpdatePasswordRequestWithPhoneNumberCopyWith( - _$UpdatePasswordRequestWithPhoneNumber value, - $Res Function(_$UpdatePasswordRequestWithPhoneNumber) then) = - __$$UpdatePasswordRequestWithPhoneNumberCopyWithImpl<$Res>; + factory $UpdatePasswordRequestWithEmailCopyWith( + UpdatePasswordRequestWithEmail value, + $Res Function(UpdatePasswordRequestWithEmail) _then) = + _$UpdatePasswordRequestWithEmailCopyWithImpl; @override @useResult - $Res call({String phoneNumber, String verificationCode, String newPassword}); + $Res call({String email, String verificationCode, String newPassword}); } /// @nodoc -class __$$UpdatePasswordRequestWithPhoneNumberCopyWithImpl<$Res> - extends _$UpdatePasswordRequestCopyWithImpl<$Res, - _$UpdatePasswordRequestWithPhoneNumber> - implements _$$UpdatePasswordRequestWithPhoneNumberCopyWith<$Res> { - __$$UpdatePasswordRequestWithPhoneNumberCopyWithImpl( - _$UpdatePasswordRequestWithPhoneNumber _value, - $Res Function(_$UpdatePasswordRequestWithPhoneNumber) _then) - : super(_value, _then); +class _$UpdatePasswordRequestWithEmailCopyWithImpl<$Res> + implements $UpdatePasswordRequestWithEmailCopyWith<$Res> { + _$UpdatePasswordRequestWithEmailCopyWithImpl(this._self, this._then); - @pragma('vm:prefer-inline') + final UpdatePasswordRequestWithEmail _self; + final $Res Function(UpdatePasswordRequestWithEmail) _then; + + /// Create a copy of UpdatePasswordRequest + /// with the given fields replaced by the non-null parameter values. @override + @pragma('vm:prefer-inline') $Res call({ - Object? phoneNumber = null, + Object? email = null, Object? verificationCode = null, Object? newPassword = null, }) { - return _then(_$UpdatePasswordRequestWithPhoneNumber( - phoneNumber: null == phoneNumber - ? _value.phoneNumber - : phoneNumber // ignore: cast_nullable_to_non_nullable + return _then(UpdatePasswordRequestWithEmail( + email: null == email + ? _self.email + : email // ignore: cast_nullable_to_non_nullable as String, verificationCode: null == verificationCode - ? _value.verificationCode + ? _self.verificationCode : verificationCode // ignore: cast_nullable_to_non_nullable as String, newPassword: null == newPassword - ? _value.newPassword + ? _self.newPassword : newPassword // ignore: cast_nullable_to_non_nullable as String, )); @@ -810,30 +591,32 @@ class __$$UpdatePasswordRequestWithPhoneNumberCopyWithImpl<$Res> /// @nodoc -class _$UpdatePasswordRequestWithPhoneNumber - implements UpdatePasswordRequestWithPhoneNumber { - const _$UpdatePasswordRequestWithPhoneNumber( +class UpdatePasswordRequestWithPhoneNumber implements UpdatePasswordRequest { + const UpdatePasswordRequestWithPhoneNumber( {required this.phoneNumber, required this.verificationCode, required this.newPassword}); - @override final String phoneNumber; - @override final String verificationCode; @override final String newPassword; + /// Create a copy of UpdatePasswordRequest + /// with the given fields replaced by the non-null parameter values. @override - String toString() { - return 'UpdatePasswordRequest.withPhoneNumber(phoneNumber: $phoneNumber, verificationCode: $verificationCode, newPassword: $newPassword)'; - } + @JsonKey(includeFromJson: false, includeToJson: false) + @pragma('vm:prefer-inline') + $UpdatePasswordRequestWithPhoneNumberCopyWith< + UpdatePasswordRequestWithPhoneNumber> + get copyWith => _$UpdatePasswordRequestWithPhoneNumberCopyWithImpl< + UpdatePasswordRequestWithPhoneNumber>(this, _$identity); @override - bool operator ==(dynamic other) { + bool operator ==(Object other) { return identical(this, other) || (other.runtimeType == runtimeType && - other is _$UpdatePasswordRequestWithPhoneNumber && + other is UpdatePasswordRequestWithPhoneNumber && (identical(other.phoneNumber, phoneNumber) || other.phoneNumber == phoneNumber) && (identical(other.verificationCode, verificationCode) || @@ -846,133 +629,56 @@ class _$UpdatePasswordRequestWithPhoneNumber int get hashCode => Object.hash(runtimeType, phoneNumber, verificationCode, newPassword); - @JsonKey(ignore: true) - @override - @pragma('vm:prefer-inline') - _$$UpdatePasswordRequestWithPhoneNumberCopyWith< - _$UpdatePasswordRequestWithPhoneNumber> - get copyWith => __$$UpdatePasswordRequestWithPhoneNumberCopyWithImpl< - _$UpdatePasswordRequestWithPhoneNumber>(this, _$identity); - - @override - @optionalTypeArgs - TResult when({ - required TResult Function( - AuthToken authToken, String oldPassword, String newPassword) - withAccessToken, - required TResult Function(AuthToken freshAuthToken, String newPassword) - withFreshAccessToken, - required TResult Function( - String email, String verificationCode, String newPassword) - withEmail, - required TResult Function( - String phoneNumber, String verificationCode, String newPassword) - withPhoneNumber, - }) { - return withPhoneNumber(phoneNumber, verificationCode, newPassword); - } - @override - @optionalTypeArgs - TResult? whenOrNull({ - TResult? Function( - AuthToken authToken, String oldPassword, String newPassword)? - withAccessToken, - TResult? Function(AuthToken freshAuthToken, String newPassword)? - withFreshAccessToken, - TResult? Function( - String email, String verificationCode, String newPassword)? - withEmail, - TResult? Function( - String phoneNumber, String verificationCode, String newPassword)? - withPhoneNumber, - }) { - return withPhoneNumber?.call(phoneNumber, verificationCode, newPassword); + String toString() { + return 'UpdatePasswordRequest.withPhoneNumber(phoneNumber: $phoneNumber, verificationCode: $verificationCode, newPassword: $newPassword)'; } +} +/// @nodoc +abstract mixin class $UpdatePasswordRequestWithPhoneNumberCopyWith<$Res> + implements $UpdatePasswordRequestCopyWith<$Res> { + factory $UpdatePasswordRequestWithPhoneNumberCopyWith( + UpdatePasswordRequestWithPhoneNumber value, + $Res Function(UpdatePasswordRequestWithPhoneNumber) _then) = + _$UpdatePasswordRequestWithPhoneNumberCopyWithImpl; @override - @optionalTypeArgs - TResult maybeWhen({ - TResult Function( - AuthToken authToken, String oldPassword, String newPassword)? - withAccessToken, - TResult Function(AuthToken freshAuthToken, String newPassword)? - withFreshAccessToken, - TResult Function(String email, String verificationCode, String newPassword)? - withEmail, - TResult Function( - String phoneNumber, String verificationCode, String newPassword)? - withPhoneNumber, - required TResult orElse(), - }) { - if (withPhoneNumber != null) { - return withPhoneNumber(phoneNumber, verificationCode, newPassword); - } - return orElse(); - } + @useResult + $Res call({String phoneNumber, String verificationCode, String newPassword}); +} - @override - @optionalTypeArgs - TResult map({ - required TResult Function(UpdatePasswordRequestWithAccessToken value) - withAccessToken, - required TResult Function(UpdatePasswordRequestWithFreshAccessToken value) - withFreshAccessToken, - required TResult Function(UpdatePasswordRequestWithEmail value) withEmail, - required TResult Function(UpdatePasswordRequestWithPhoneNumber value) - withPhoneNumber, - }) { - return withPhoneNumber(this); - } +/// @nodoc +class _$UpdatePasswordRequestWithPhoneNumberCopyWithImpl<$Res> + implements $UpdatePasswordRequestWithPhoneNumberCopyWith<$Res> { + _$UpdatePasswordRequestWithPhoneNumberCopyWithImpl(this._self, this._then); - @override - @optionalTypeArgs - TResult? mapOrNull({ - TResult? Function(UpdatePasswordRequestWithAccessToken value)? - withAccessToken, - TResult? Function(UpdatePasswordRequestWithFreshAccessToken value)? - withFreshAccessToken, - TResult? Function(UpdatePasswordRequestWithEmail value)? withEmail, - TResult? Function(UpdatePasswordRequestWithPhoneNumber value)? - withPhoneNumber, - }) { - return withPhoneNumber?.call(this); - } + final UpdatePasswordRequestWithPhoneNumber _self; + final $Res Function(UpdatePasswordRequestWithPhoneNumber) _then; + /// Create a copy of UpdatePasswordRequest + /// with the given fields replaced by the non-null parameter values. @override - @optionalTypeArgs - TResult maybeMap({ - TResult Function(UpdatePasswordRequestWithAccessToken value)? - withAccessToken, - TResult Function(UpdatePasswordRequestWithFreshAccessToken value)? - withFreshAccessToken, - TResult Function(UpdatePasswordRequestWithEmail value)? withEmail, - TResult Function(UpdatePasswordRequestWithPhoneNumber value)? - withPhoneNumber, - required TResult orElse(), + @pragma('vm:prefer-inline') + $Res call({ + Object? phoneNumber = null, + Object? verificationCode = null, + Object? newPassword = null, }) { - if (withPhoneNumber != null) { - return withPhoneNumber(this); - } - return orElse(); + return _then(UpdatePasswordRequestWithPhoneNumber( + phoneNumber: null == phoneNumber + ? _self.phoneNumber + : phoneNumber // ignore: cast_nullable_to_non_nullable + as String, + verificationCode: null == verificationCode + ? _self.verificationCode + : verificationCode // ignore: cast_nullable_to_non_nullable + as String, + newPassword: null == newPassword + ? _self.newPassword + : newPassword // ignore: cast_nullable_to_non_nullable + as String, + )); } } -abstract class UpdatePasswordRequestWithPhoneNumber - implements UpdatePasswordRequest { - const factory UpdatePasswordRequestWithPhoneNumber( - {required final String phoneNumber, - required final String verificationCode, - required final String newPassword}) = - _$UpdatePasswordRequestWithPhoneNumber; - - String get phoneNumber; - String get verificationCode; - @override - String get newPassword; - @override - @JsonKey(ignore: true) - _$$UpdatePasswordRequestWithPhoneNumberCopyWith< - _$UpdatePasswordRequestWithPhoneNumber> - get copyWith => throw _privateConstructorUsedError; -} +// dart format on diff --git a/flutter_reach_five/lib/reach_five.dart b/flutter_reach_five/lib/reach_five.dart index c46dfe7..b765225 100644 --- a/flutter_reach_five/lib/reach_five.dart +++ b/flutter_reach_five/lib/reach_five.dart @@ -325,10 +325,10 @@ class ReachFive { final revokeTokenRequest = RevokeTokenRequest( clientId: reachFiveKey.sdkConfig.clientId, clientSecret: clientSecret ?? '', - token: revokeTokenType.map( - refresh: authToken.refreshToken ?? '', - access: authToken.accessToken, - ), + token: switch (revokeTokenType) { + RevokeTokenType.refresh => authToken.refreshToken ?? '', + RevokeTokenType.access => authToken.accessToken, + }, tokenTypeHint: authToken.tokenType, ); @@ -378,40 +378,50 @@ class ReachFive { UpdatePasswordRequest updatePasswordRequest, ) async { try { - await updatePasswordRequest.map>( - withAccessToken: (updatePasswordRequestWithAccessToken) => - _platform.updatePasswordWithAccessToken( - reachFiveKey: ReachFiveKeyConverter.toInterface(reachFiveKey), - authToken: AuthTokenConverter.toInterface( - updatePasswordRequestWithAccessToken.authToken, + await switch (updatePasswordRequest) { + UpdatePasswordRequestWithAccessToken( + :final authToken, + :final oldPassword, + :final newPassword + ) => + _platform.updatePasswordWithAccessToken( + reachFiveKey: ReachFiveKeyConverter.toInterface(reachFiveKey), + authToken: AuthTokenConverter.toInterface(authToken), + oldPassword: oldPassword, + newPassword: newPassword, ), - oldPassword: updatePasswordRequestWithAccessToken.oldPassword, - newPassword: updatePasswordRequestWithAccessToken.newPassword, - ), - withFreshAccessToken: (updatePasswordRequestWithFreshAccessToken) => - _platform.updatePasswordWithFreshAccessToken( - reachFiveKey: ReachFiveKeyConverter.toInterface(reachFiveKey), - freshAuthToken: AuthTokenConverter.toInterface( - updatePasswordRequestWithFreshAccessToken.freshAuthToken, + UpdatePasswordRequestWithFreshAccessToken( + :final freshAuthToken, + :final newPassword + ) => + _platform.updatePasswordWithFreshAccessToken( + reachFiveKey: ReachFiveKeyConverter.toInterface(reachFiveKey), + freshAuthToken: AuthTokenConverter.toInterface(freshAuthToken), + newPassword: newPassword, ), - newPassword: updatePasswordRequestWithFreshAccessToken.newPassword, - ), - withEmail: (updatePasswordRequestWithEmail) => - _platform.updatePasswordWithEmail( - reachFiveKey: ReachFiveKeyConverter.toInterface(reachFiveKey), - email: updatePasswordRequestWithEmail.email, - verificationCode: updatePasswordRequestWithEmail.verificationCode, - newPassword: updatePasswordRequestWithEmail.newPassword, - ), - withPhoneNumber: (updatePasswordRequestWithPhoneNumber) => - _platform.updatePasswordWithPhoneNumber( - reachFiveKey: ReachFiveKeyConverter.toInterface(reachFiveKey), - phoneNumber: updatePasswordRequestWithPhoneNumber.phoneNumber, - verificationCode: - updatePasswordRequestWithPhoneNumber.verificationCode, - newPassword: updatePasswordRequestWithPhoneNumber.newPassword, - ), - ); + UpdatePasswordRequestWithEmail( + :final email, + :final verificationCode, + :final newPassword + ) => + _platform.updatePasswordWithEmail( + reachFiveKey: ReachFiveKeyConverter.toInterface(reachFiveKey), + email: email, + verificationCode: verificationCode, + newPassword: newPassword, + ), + UpdatePasswordRequestWithPhoneNumber( + :final phoneNumber, + :final verificationCode, + :final newPassword + ) => + _platform.updatePasswordWithPhoneNumber( + reachFiveKey: ReachFiveKeyConverter.toInterface(reachFiveKey), + phoneNumber: phoneNumber, + verificationCode: verificationCode, + newPassword: newPassword, + ), + }; } catch (error, stackTrace) { try { _platform.parseError(error, stackTrace); diff --git a/flutter_reach_five/pubspec.yaml b/flutter_reach_five/pubspec.yaml index f30f2b9..e44017c 100644 --- a/flutter_reach_five/pubspec.yaml +++ b/flutter_reach_five/pubspec.yaml @@ -5,8 +5,8 @@ homepage: https://github.com/bamlab/Flutter-ReachFive repository: https://github.com/bamlab/Flutter-ReachFive environment: - sdk: ">=3.0.0 <4.0.0" - flutter: ">=3.16.0" + sdk: '>=3.0.0 <4.0.0' + flutter: '>=3.16.0' flutter: plugin: @@ -25,13 +25,13 @@ dependencies: flutter_reach_five_android: ^0.5.1 flutter_reach_five_ios: ^0.4.2 flutter_reach_five_platform_interface: ^0.4.2 - freezed: ^2.1.0+1 - freezed_annotation: ^2.1.0 + freezed: ^3.2.3 + freezed_annotation: ^3.1.0 reach_five_identity_repo: ^0.5.1 dev_dependencies: build_runner: ^2.4.8 - custom_lint: ^0.2.12 + custom_lint: ^0.8.1 flutter_test: sdk: flutter mocktail: ^1.0.3