From f79d173c06becdfb02ddfc653d61ca01b3e5c6cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petrus=20Nguy=E1=BB=85n=20Th=C3=A1i=20H=E1=BB=8Dc?= Date: Sun, 27 Oct 2024 18:40:08 +0700 Subject: [PATCH] Dart 3 (#103) * dart 3.0.0 * dart 3.0.0 * pub * pub * pub * pub * pub * up * up --- .github/workflows/flutter.yml | 8 +- analysis_options.yaml | 6 + android/app/build.gradle | 32 +- android/app/src/main/AndroidManifest.xml | 3 +- android/build.gradle | 19 +- .../gradle/wrapper/gradle-wrapper.properties | 2 +- android/settings.gradle | 32 +- lib/app.dart | 4 +- .../entities/user_and_token_entity.g.dart | 8 +- lib/data/local/entities/user_entity.g.dart | 12 +- lib/data/local/shared_pref_util.dart | 11 +- lib/data/remote/api_service.dart | 12 +- .../remote/response/token_response.g.dart | 8 +- lib/data/remote/response/user_response.g.dart | 12 +- lib/data/serializers.g.dart | 2 +- lib/data/user_repository_imp.dart | 18 +- lib/domain/models/auth_state.g.dart | 7 +- lib/domain/models/user.g.dart | 12 +- lib/domain/models/user_and_token.g.dart | 8 +- lib/main.dart | 62 +-- .../change_password/change_password_bloc.dart | 50 +- .../change_password_bottomsheet.dart | 2 +- .../change_password_state.g.dart | 10 +- lib/pages/home/home_page.dart | 62 ++- lib/pages/home/home_profile_widget.dart | 4 +- lib/pages/home/home_state.dart | 6 +- lib/pages/login/login_bloc.dart | 2 +- lib/pages/login/login_page.dart | 38 +- lib/pages/login/login_state.dart | 2 +- lib/pages/register/register_bloc.dart | 2 +- lib/pages/register/register_page.dart | 31 +- lib/pages/register/register_state.dart | 2 +- .../input_token_and_reset_password_bloc.dart | 47 +- .../input_token_and_reset_password_page.dart | 3 +- .../reset_password/reset_password_page.dart | 2 +- .../send_email/send_email_page.dart | 18 +- .../send_email/send_email_state.dart | 5 +- lib/utils/result.dart | 1 - lib/utils/streams.dart | 2 +- lib/widgets/password_textfield.dart | 4 +- pubspec.lock | 435 +++++++++--------- pubspec.yaml | 47 +- .../flutter/generated_plugin_registrant.cc | 3 + windows/flutter/generated_plugins.cmake | 1 + 44 files changed, 569 insertions(+), 488 deletions(-) delete mode 100644 lib/utils/result.dart diff --git a/.github/workflows/flutter.yml b/.github/workflows/flutter.yml index 40f651e..a3c068d 100644 --- a/.github/workflows/flutter.yml +++ b/.github/workflows/flutter.yml @@ -12,7 +12,7 @@ jobs: strategy: matrix: - flutter-channel: [ 'stable', 'beta' ] + flutter-channel: [ 'stable' ] steps: - uses: actions/checkout@v3 @@ -20,7 +20,7 @@ jobs: - uses: actions/setup-java@v3 with: distribution: 'zulu' - java-version: '11' + java-version: '17' - uses: subosito/flutter-action@v2 with: @@ -33,7 +33,7 @@ jobs: run: flutter --version - name: Install dependencies - run: flutter pub get + run: dart pub get - name: Format code if: ${{ matrix.flutter-channel == 'stable' }} @@ -44,7 +44,7 @@ jobs: run: dart analyze lib - name: Gen code - run: flutter packages pub run build_runner build --delete-conflicting-outputs + run: dart run build_runner build --delete-conflicting-outputs - name: Build Debug APK run: flutter build apk --debug --no-shrink diff --git a/analysis_options.yaml b/analysis_options.yaml index 7de1b58..1804f5f 100644 --- a/analysis_options.yaml +++ b/analysis_options.yaml @@ -1,5 +1,11 @@ include: package:flutter_lints/flutter.yaml +analyzer: + language: + strict-casts: true + strict-raw-types: true + strict-inference: true + linter: rules: - prefer_final_locals diff --git a/android/app/build.gradle b/android/app/build.gradle index 7755897..8ec447d 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -1,3 +1,16 @@ +plugins { + id "com.android.application" + id "kotlin-android" + id "dev.flutter.flutter-gradle-plugin" +} + +kotlin { + jvmToolchain { + languageVersion = JavaLanguageVersion.of(17) + vendor = JvmVendorSpec.AZUL + } +} + def localProperties = new Properties() def localPropertiesFile = rootProject.file('local.properties') if (localPropertiesFile.exists()) { @@ -6,11 +19,6 @@ if (localPropertiesFile.exists()) { } } -def flutterRoot = localProperties.getProperty('flutter.sdk') -if (flutterRoot == null) { - throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.") -} - def flutterVersionCode = localProperties.getProperty('flutter.versionCode') if (flutterVersionCode == null) { flutterVersionCode = '1' @@ -21,12 +29,9 @@ if (flutterVersionName == null) { flutterVersionName = '1.0' } -apply plugin: 'com.android.application' -apply plugin: 'kotlin-android' -apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" - android { - compileSdkVersion 33 + compileSdkVersion 34 + namespace "com.hoc.node_auth" compileOptions { sourceCompatibility JavaVersion.VERSION_1_8 @@ -45,7 +50,7 @@ android { // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). applicationId "com.hoc.node_auth" minSdkVersion 21 - targetSdkVersion 33 + targetSdkVersion 34 versionCode flutterVersionCode.toInteger() versionName flutterVersionName multiDexEnabled true @@ -65,11 +70,10 @@ flutter { } dependencies { - implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" implementation "androidx.multidex:multidex:2.0.1" implementation "com.google.crypto.tink:tink-android:1.7.0" - implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.4' - implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.6.4' + implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.9.0-RC.2' + implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.9.0-RC.2' } diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml index a8abd2e..718dc43 100644 --- a/android/app/src/main/AndroidManifest.xml +++ b/android/app/src/main/AndroidManifest.xml @@ -1,5 +1,4 @@ - + diff --git a/android/build.gradle b/android/build.gradle index 4256f91..c709783 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -1,20 +1,7 @@ -buildscript { - ext.kotlin_version = '1.6.10' - repositories { - google() - mavenCentral() - } - - dependencies { - classpath 'com.android.tools.build:gradle:4.1.0' - classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" - } -} - allprojects { repositories { google() - mavenCentral() + jcenter() } } @@ -26,6 +13,6 @@ subprojects { project.evaluationDependsOn(':app') } -task clean(type: Delete) { +tasks.register("clean", Delete) { delete rootProject.buildDir -} +} \ No newline at end of file diff --git a/android/gradle/wrapper/gradle-wrapper.properties b/android/gradle/wrapper/gradle-wrapper.properties index 0e5abae..75db638 100644 --- a/android/gradle/wrapper/gradle-wrapper.properties +++ b/android/gradle/wrapper/gradle-wrapper.properties @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-6.9.2-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.10-bin.zip diff --git a/android/settings.gradle b/android/settings.gradle index 44e62bc..c81e15b 100644 --- a/android/settings.gradle +++ b/android/settings.gradle @@ -1,11 +1,27 @@ -include ':app' +pluginManagement { + def flutterSdkPath = { + def properties = new Properties() + file("local.properties").withInputStream { properties.load(it) } + def flutterSdkPath = properties.getProperty("flutter.sdk") + assert flutterSdkPath != null, "flutter.sdk not set in local.properties" + return flutterSdkPath + }() -def localPropertiesFile = new File(rootProject.projectDir, "local.properties") -def properties = new Properties() + includeBuild("$flutterSdkPath/packages/flutter_tools/gradle") -assert localPropertiesFile.exists() -localPropertiesFile.withReader("UTF-8") { reader -> properties.load(reader) } + repositories { + google() + mavenCentral() + gradlePluginPortal() + } +} -def flutterSdkPath = properties.getProperty("flutter.sdk") -assert flutterSdkPath != null, "flutter.sdk not set in local.properties" -apply from: "$flutterSdkPath/packages/flutter_tools/gradle/app_plugin_loader.gradle" +plugins { + id "dev.flutter.flutter-plugin-loader" version "1.0.0" + id "com.android.application" version "8.5.2" apply false + id "org.jetbrains.kotlin.android" version "2.0.20" apply false + id("org.gradle.toolchains.foojay-resolver-convention") version("0.8.0") +} + +rootProject.name = "github_search" +include ":app" \ No newline at end of file diff --git a/lib/app.dart b/lib/app.dart index 5997b86..42671f4 100644 --- a/lib/app.dart +++ b/lib/app.dart @@ -18,7 +18,7 @@ import 'package:node_auth/pages/reset_password/reset_password_page.dart'; import 'package:node_auth/utils/streams.dart'; class MyApp extends StatelessWidget { - const MyApp({Key? key}) : super(key: key); + const MyApp({super.key}); @override Widget build(BuildContext context) { @@ -81,7 +81,7 @@ class MyApp extends StatelessWidget { } class Home extends StatefulWidget { - const Home({Key? key}) : super(key: key); + const Home({super.key}); @override State createState() => _HomeState(); diff --git a/lib/data/local/entities/user_and_token_entity.g.dart b/lib/data/local/entities/user_and_token_entity.g.dart index 3a89031..05aa856 100644 --- a/lib/data/local/entities/user_and_token_entity.g.dart +++ b/lib/data/local/entities/user_and_token_entity.g.dart @@ -95,7 +95,11 @@ class _$UserAndTokenEntity extends UserAndTokenEntity { @override int get hashCode { - return $jf($jc($jc(0, token.hashCode), user.hashCode)); + var _$hash = 0; + _$hash = $jc(_$hash, token.hashCode); + _$hash = $jc(_$hash, user.hashCode); + _$hash = $jf(_$hash); + return _$hash; } @override @@ -169,4 +173,4 @@ class UserAndTokenEntityBuilder } } -// ignore_for_file: always_put_control_body_on_new_line,always_specify_types,annotate_overrides,avoid_annotating_with_dynamic,avoid_as,avoid_catches_without_on_clauses,avoid_returning_this,deprecated_member_use_from_same_package,lines_longer_than_80_chars,no_leading_underscores_for_local_identifiers,omit_local_variable_types,prefer_expression_function_bodies,sort_constructors_first,test_types_in_equals,unnecessary_const,unnecessary_new,unnecessary_lambdas +// ignore_for_file: deprecated_member_use_from_same_package,type=lint diff --git a/lib/data/local/entities/user_entity.g.dart b/lib/data/local/entities/user_entity.g.dart index 60148f8..5a692ba 100644 --- a/lib/data/local/entities/user_entity.g.dart +++ b/lib/data/local/entities/user_entity.g.dart @@ -116,9 +116,13 @@ class _$UserEntity extends UserEntity { @override int get hashCode { - return $jf($jc( - $jc($jc($jc(0, name.hashCode), email.hashCode), createdAt.hashCode), - imageUrl.hashCode)); + var _$hash = 0; + _$hash = $jc(_$hash, name.hashCode); + _$hash = $jc(_$hash, email.hashCode); + _$hash = $jc(_$hash, createdAt.hashCode); + _$hash = $jc(_$hash, imageUrl.hashCode); + _$hash = $jf(_$hash); + return _$hash; } @override @@ -194,4 +198,4 @@ class UserEntityBuilder implements Builder { } } -// ignore_for_file: always_put_control_body_on_new_line,always_specify_types,annotate_overrides,avoid_annotating_with_dynamic,avoid_as,avoid_catches_without_on_clauses,avoid_returning_this,deprecated_member_use_from_same_package,lines_longer_than_80_chars,no_leading_underscores_for_local_identifiers,omit_local_variable_types,prefer_expression_function_bodies,sort_constructors_first,test_types_in_equals,unnecessary_const,unnecessary_new,unnecessary_lambdas +// ignore_for_file: deprecated_member_use_from_same_package,type=lint diff --git a/lib/data/local/shared_pref_util.dart b/lib/data/local/shared_pref_util.dart index 7cdf86d..27a9e21 100644 --- a/lib/data/local/shared_pref_util.dart +++ b/lib/data/local/shared_pref_util.dart @@ -48,12 +48,11 @@ class SharedPrefUtil implements LocalDataSource { // Encoder and Decoder // - FutureOr _toEntity(dynamic jsonString) => - jsonString == null - ? null - : _crypto - .decrypt(jsonString as String) - .then((s) => UserAndTokenEntity.fromJson(jsonDecode(s))); + FutureOr _toEntity(dynamic jsonString) => jsonString == + null + ? null + : _crypto.decrypt(jsonString as String).then((s) => + UserAndTokenEntity.fromJson(jsonDecode(s) as Map)); FutureOr _toString(UserAndTokenEntity? entity) => entity == null ? null : _crypto.encrypt(jsonEncode(entity)); diff --git a/lib/data/remote/api_service.dart b/lib/data/remote/api_service.dart index 34068eb..6a486e9 100644 --- a/lib/data/remote/api_service.dart +++ b/lib/data/remote/api_service.dart @@ -62,7 +62,7 @@ class ApiService implements RemoteDataSource { HttpHeaders.authorizationHeader: basic, }, cancelToken: cancelToken, - ); + ) as Map; return TokenResponse.fromJson(json); }); @@ -87,7 +87,7 @@ class ApiService implements RemoteDataSource { url, body: body, cancelToken: cancelToken, - ); + ) as Map; return TokenResponse.fromJson(decoded); }); @@ -106,7 +106,7 @@ class ApiService implements RemoteDataSource { url, headers: {xAccessToken: token}, cancelToken: cancelToken, - ); + ) as Map; return UserResponse.fromJson(json); }); @@ -129,7 +129,7 @@ class ApiService implements RemoteDataSource { headers: {xAccessToken: token}, body: body, cancelToken: cancelToken, - ); + ) as Map; return TokenResponse.fromJson(json); }); @@ -160,7 +160,7 @@ class ApiService implements RemoteDataSource { url, cancelToken: cancelToken, ); - final json = await task; + final json = await task as Map; return TokenResponse.fromJson(json); }); @@ -198,7 +198,7 @@ class ApiService implements RemoteDataSource { fields: {'user': email}, headers: {xAccessToken: token}, cancelToken: cancelToken, - ); + ) as Map; return UserResponse.fromJson(decoded); }); } diff --git a/lib/data/remote/response/token_response.g.dart b/lib/data/remote/response/token_response.g.dart index 1eaebee..196763c 100644 --- a/lib/data/remote/response/token_response.g.dart +++ b/lib/data/remote/response/token_response.g.dart @@ -91,7 +91,11 @@ class _$TokenResponse extends TokenResponse { @override int get hashCode { - return $jf($jc($jc(0, token.hashCode), message.hashCode)); + var _$hash = 0; + _$hash = $jc(_$hash, token.hashCode); + _$hash = $jc(_$hash, message.hashCode); + _$hash = $jf(_$hash); + return _$hash; } @override @@ -152,4 +156,4 @@ class TokenResponseBuilder } } -// ignore_for_file: always_put_control_body_on_new_line,always_specify_types,annotate_overrides,avoid_annotating_with_dynamic,avoid_as,avoid_catches_without_on_clauses,avoid_returning_this,deprecated_member_use_from_same_package,lines_longer_than_80_chars,no_leading_underscores_for_local_identifiers,omit_local_variable_types,prefer_expression_function_bodies,sort_constructors_first,test_types_in_equals,unnecessary_const,unnecessary_new,unnecessary_lambdas +// ignore_for_file: deprecated_member_use_from_same_package,type=lint diff --git a/lib/data/remote/response/user_response.g.dart b/lib/data/remote/response/user_response.g.dart index c6ac862..bd25da3 100644 --- a/lib/data/remote/response/user_response.g.dart +++ b/lib/data/remote/response/user_response.g.dart @@ -118,9 +118,13 @@ class _$UserResponse extends UserResponse { @override int get hashCode { - return $jf($jc( - $jc($jc($jc(0, name.hashCode), email.hashCode), createdAt.hashCode), - imageUrl.hashCode)); + var _$hash = 0; + _$hash = $jc(_$hash, name.hashCode); + _$hash = $jc(_$hash, email.hashCode); + _$hash = $jc(_$hash, createdAt.hashCode); + _$hash = $jc(_$hash, imageUrl.hashCode); + _$hash = $jf(_$hash); + return _$hash; } @override @@ -197,4 +201,4 @@ class UserResponseBuilder } } -// ignore_for_file: always_put_control_body_on_new_line,always_specify_types,annotate_overrides,avoid_annotating_with_dynamic,avoid_as,avoid_catches_without_on_clauses,avoid_returning_this,deprecated_member_use_from_same_package,lines_longer_than_80_chars,no_leading_underscores_for_local_identifiers,omit_local_variable_types,prefer_expression_function_bodies,sort_constructors_first,test_types_in_equals,unnecessary_const,unnecessary_new,unnecessary_lambdas +// ignore_for_file: deprecated_member_use_from_same_package,type=lint diff --git a/lib/data/serializers.g.dart b/lib/data/serializers.g.dart index 6641687..ae612d4 100644 --- a/lib/data/serializers.g.dart +++ b/lib/data/serializers.g.dart @@ -13,4 +13,4 @@ Serializers _$serializers = (new Serializers().toBuilder() ..add(UserResponse.serializer)) .build(); -// ignore_for_file: always_put_control_body_on_new_line,always_specify_types,annotate_overrides,avoid_annotating_with_dynamic,avoid_as,avoid_catches_without_on_clauses,avoid_returning_this,deprecated_member_use_from_same_package,lines_longer_than_80_chars,no_leading_underscores_for_local_identifiers,omit_local_variable_types,prefer_expression_function_bodies,sort_constructors_first,test_types_in_equals,unnecessary_const,unnecessary_new,unnecessary_lambdas +// ignore_for_file: deprecated_member_use_from_same_package,type=lint diff --git a/lib/data/user_repository_imp.dart b/lib/data/user_repository_imp.dart index d64fb99..3288dea 100644 --- a/lib/data/user_repository_imp.dart +++ b/lib/data/user_repository_imp.dart @@ -15,10 +15,11 @@ import 'package:node_auth/domain/models/user.dart'; import 'package:node_auth/domain/models/user_and_token.dart'; import 'package:node_auth/domain/repositories/user_repository.dart'; import 'package:node_auth/utils/streams.dart'; -import 'package:tuple/tuple.dart'; part 'mappers.dart'; +typedef _UserResponseAndToken = ({UserResponse user, String token}); + class UserRepositoryImpl implements UserRepository { final RemoteDataSource _remoteDataSource; final LocalDataSource _localDataSource; @@ -57,15 +58,15 @@ class UserRepositoryImpl implements UserRepository { return _remoteDataSource .getUserProfile(email, token) - .map((user) => Tuple2(user, token)) + .map<_UserResponseAndToken>((user) => (user: user, token: token)) .toEitherSingle(_Mappers.errorToAppError); }) .flatMapEitherSingle( (tuple) => _localDataSource .saveUserAndToken( _Mappers.userResponseToUserAndTokenEntity( - tuple.item1, - tuple.item2, + tuple.user, + tuple.token, ), ) .toEitherSingle(_Mappers.errorToAppError), @@ -100,7 +101,7 @@ class UserRepositoryImpl implements UserRepository { message: 'Require login!', error: 'Email or token is null', stackTrace: StackTrace.current, - ).left(), + ).left<_UserResponseAndToken>(), ); } @@ -110,15 +111,16 @@ class UserRepositoryImpl implements UserRepository { userAndToken.user.email, userAndToken.token, ) - .map((user) => Tuple2(user, userAndToken.token)) + .map<_UserResponseAndToken>( + (user) => (user: user, token: userAndToken.token)) .toEitherSingle(_Mappers.errorToAppError); }) .flatMapEitherSingle( (tuple) => _localDataSource .saveUserAndToken( _Mappers.userResponseToUserAndTokenEntity( - tuple.item1, - tuple.item2, + tuple.user, + tuple.token, ), ) .toEitherSingle(_Mappers.errorToAppError), diff --git a/lib/domain/models/auth_state.g.dart b/lib/domain/models/auth_state.g.dart index 921533f..7a6f2c9 100644 --- a/lib/domain/models/auth_state.g.dart +++ b/lib/domain/models/auth_state.g.dart @@ -36,7 +36,10 @@ class _$AuthenticatedState extends AuthenticatedState { @override int get hashCode { - return $jf($jc(0, userAndToken.hashCode)); + var _$hash = 0; + _$hash = $jc(_$hash, userAndToken.hashCode); + _$hash = $jf(_$hash); + return _$hash; } @override @@ -163,4 +166,4 @@ class UnauthenticatedStateBuilder } } -// ignore_for_file: always_put_control_body_on_new_line,always_specify_types,annotate_overrides,avoid_annotating_with_dynamic,avoid_as,avoid_catches_without_on_clauses,avoid_returning_this,deprecated_member_use_from_same_package,lines_longer_than_80_chars,no_leading_underscores_for_local_identifiers,omit_local_variable_types,prefer_expression_function_bodies,sort_constructors_first,test_types_in_equals,unnecessary_const,unnecessary_new,unnecessary_lambdas +// ignore_for_file: deprecated_member_use_from_same_package,type=lint diff --git a/lib/domain/models/user.g.dart b/lib/domain/models/user.g.dart index 1ef691d..ed8f7d6 100644 --- a/lib/domain/models/user.g.dart +++ b/lib/domain/models/user.g.dart @@ -49,9 +49,13 @@ class _$User extends User { @override int get hashCode { - return $jf($jc( - $jc($jc($jc(0, name.hashCode), email.hashCode), createdAt.hashCode), - imageUrl.hashCode)); + var _$hash = 0; + _$hash = $jc(_$hash, name.hashCode); + _$hash = $jc(_$hash, email.hashCode); + _$hash = $jc(_$hash, createdAt.hashCode); + _$hash = $jc(_$hash, imageUrl.hashCode); + _$hash = $jf(_$hash); + return _$hash; } @override @@ -126,4 +130,4 @@ class UserBuilder implements Builder { } } -// ignore_for_file: always_put_control_body_on_new_line,always_specify_types,annotate_overrides,avoid_annotating_with_dynamic,avoid_as,avoid_catches_without_on_clauses,avoid_returning_this,deprecated_member_use_from_same_package,lines_longer_than_80_chars,no_leading_underscores_for_local_identifiers,omit_local_variable_types,prefer_expression_function_bodies,sort_constructors_first,test_types_in_equals,unnecessary_const,unnecessary_new,unnecessary_lambdas +// ignore_for_file: deprecated_member_use_from_same_package,type=lint diff --git a/lib/domain/models/user_and_token.g.dart b/lib/domain/models/user_and_token.g.dart index 5fe79e2..da77030 100644 --- a/lib/domain/models/user_and_token.g.dart +++ b/lib/domain/models/user_and_token.g.dart @@ -35,7 +35,11 @@ class _$UserAndToken extends UserAndToken { @override int get hashCode { - return $jf($jc($jc(0, token.hashCode), user.hashCode)); + var _$hash = 0; + _$hash = $jc(_$hash, token.hashCode); + _$hash = $jc(_$hash, user.hashCode); + _$hash = $jf(_$hash); + return _$hash; } @override @@ -109,4 +113,4 @@ class UserAndTokenBuilder } } -// ignore_for_file: always_put_control_body_on_new_line,always_specify_types,annotate_overrides,avoid_annotating_with_dynamic,avoid_as,avoid_catches_without_on_clauses,avoid_returning_this,deprecated_member_use_from_same_package,lines_longer_than_80_chars,no_leading_underscores_for_local_identifiers,omit_local_variable_types,prefer_expression_function_bodies,sort_constructors_first,test_types_in_equals,unnecessary_const,unnecessary_new,unnecessary_lambdas +// ignore_for_file: deprecated_member_use_from_same_package,type=lint diff --git a/lib/main.dart b/lib/main.dart index 8d98bcf..a81650c 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -1,6 +1,6 @@ import 'dart:io'; -import 'package:cupertino_http/cupertino_client.dart'; +import 'package:cupertino_http/cupertino_http.dart'; import 'package:disposebag/disposebag.dart'; import 'package:flutter/foundation.dart' show debugPrint, debugPrintSynchronously, kReleaseMode; @@ -8,6 +8,7 @@ import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:flutter_bloc_pattern/flutter_bloc_pattern.dart'; import 'package:flutter_provider/flutter_provider.dart'; +import 'package:http/http.dart' as http; import 'package:http_client_hoc081098/http_client_hoc081098.dart'; import 'package:node_auth/app.dart'; import 'package:node_auth/data/local/local_data_source.dart'; @@ -19,7 +20,6 @@ import 'package:node_auth/data/remote/remote_data_source.dart'; import 'package:node_auth/data/user_repository_imp.dart'; import 'package:node_auth/domain/repositories/user_repository.dart'; import 'package:rx_shared_preferences/rx_shared_preferences.dart'; -import 'package:http/http.dart' as http; void main() async { WidgetsFlutterBinding.ensureInitialized(); @@ -27,6 +27,38 @@ void main() async { _setupLoggers(); await SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]); + // Create http client + late final Func0> onUnauthorized; + final simpleHttpClient = createSimpleHttpClient(() => onUnauthorized()); + + // construct RemoteDataSource + final RemoteDataSource remoteDataSource = ApiService(simpleHttpClient); + + // construct LocalDataSource + final rxPrefs = RxSharedPreferences.getInstance(); + final crypto = MethodChannelCryptoImpl(); + final LocalDataSource localDataSource = SharedPrefUtil(rxPrefs, crypto); + onUnauthorized = () => localDataSource.removeUserAndToken().first; + + // construct UserRepository + final UserRepository userRepository = UserRepositoryImpl( + remoteDataSource, + localDataSource, + ); + + runApp( + Provider.value( + userRepository, + child: const MyApp(), + ), + ); +} + +SimpleHttpClient createSimpleHttpClient( + Func0> onUnauthorized, +) { + final authInterceptor = AuthInterceptor(onUnauthorized: onUnauthorized); + final loggingInterceptor = SimpleLoggingInterceptor( SimpleLogger( loggerFunction: print, @@ -38,10 +70,6 @@ void main() async { ), ); - late final Func0> onUnauthorized; - final authInterceptor = - AuthInterceptor(onUnauthorized: () => onUnauthorized()); - final simpleHttpClient = SimpleHttpClient( client: Platform.isIOS || Platform.isMacOS ? CupertinoClient.defaultSessionConfiguration() @@ -59,27 +87,7 @@ void main() async { ], ); - // construct RemoteDataSource - final RemoteDataSource remoteDataSource = ApiService(simpleHttpClient); - - // construct LocalDataSource - final rxPrefs = RxSharedPreferences.getInstance(); - final crypto = MethodChannelCryptoImpl(); - final LocalDataSource localDataSource = SharedPrefUtil(rxPrefs, crypto); - onUnauthorized = () => localDataSource.removeUserAndToken().first; - - // construct UserRepository - final UserRepository userRepository = UserRepositoryImpl( - remoteDataSource, - localDataSource, - ); - - runApp( - Provider.value( - userRepository, - child: const MyApp(), - ), - ); + return simpleHttpClient; } void _setupLoggers() { diff --git a/lib/pages/home/change_password/change_password_bloc.dart b/lib/pages/home/change_password/change_password_bloc.dart index 622746c..58f188d 100644 --- a/lib/pages/home/change_password/change_password_bloc.dart +++ b/lib/pages/home/change_password/change_password_bloc.dart @@ -8,11 +8,10 @@ import 'package:node_auth/domain/usecases/change_password_use_case.dart'; import 'package:node_auth/pages/home/change_password/change_password.dart'; import 'package:node_auth/utils/streams.dart'; import 'package:node_auth/utils/type_defs.dart'; -import 'package:tuple/tuple.dart'; -bool _isValidPassword(String password) { - return password.length >= 6; -} +bool _isValidPassword(String password) => password.length >= 6; + +typedef _FormInfo = ({String password, String newPassword}); // ignore_for_file: close_sinks @@ -49,32 +48,34 @@ class ChangePasswordBloc extends DisposeCallbackBaseBloc { /// Streams /// - final both$ = Rx.combineLatest2( + final Stream<_FormInfo> both$ = Rx.combineLatest2( passwordS.stream.startWith(''), newPasswordS.stream.startWith(''), - (String password, String newPassword) => Tuple2(password, newPassword), + (String password, String newPassword) => + (password: password, newPassword: newPassword), ).share(); - final isValidSubmit$ = both$.map((both) { - final password = both.item1; - final newPassword = both.item2; - return _isValidPassword(newPassword) && - _isValidPassword(password) && - password != newPassword; - }).shareValueSeeded(false); + final isValidSubmit$ = both$ + .map( + (formInfo) => + _isValidPassword(formInfo.newPassword) && + _isValidPassword(formInfo.password) && + formInfo.password != formInfo.newPassword, + ) + .shareValueSeeded(false); final changePasswordState$ = submitChangePasswordS.stream .withLatestFrom(isValidSubmit$, (_, bool isValid) => isValid) .debug() .where((isValid) => isValid) - .withLatestFrom(both$, (_, Tuple2 both) => both) + .withLatestFrom(both$, (_, formInfo) => formInfo) .exhaustMap((both) => _performChangePassword(changePassword, both)) .publishState(ChangePasswordState((b) => b..isLoading = false)); final passwordError$ = both$ - .map((tuple) { - final password = tuple.item1; - final newPassword = tuple.item2; + .map((formInfo) { + final password = formInfo.password; + final newPassword = formInfo.newPassword; if (!_isValidPassword(password)) { return 'Password must be at least 6 characters'; @@ -90,9 +91,9 @@ class ChangePasswordBloc extends DisposeCallbackBaseBloc { .share(); final newPasswordError$ = both$ - .map((tuple) { - final password = tuple.item1; - final newPassword = tuple.item2; + .map((formInfo) { + final password = formInfo.password; + final newPassword = formInfo.newPassword; if (!_isValidPassword(newPassword)) { return 'New password must be at least 6 characters'; @@ -107,7 +108,7 @@ class ChangePasswordBloc extends DisposeCallbackBaseBloc { .distinct() .share(); - final subscriptions = { + final subscriptions = >{ 'newPasswordError': newPasswordError$, 'passwordError': passwordError$, 'isValidSubmit': isValidSubmit$, @@ -132,9 +133,9 @@ class ChangePasswordBloc extends DisposeCallbackBaseBloc { static Stream _performChangePassword( ChangePasswordUseCase changePassword, - Tuple2 both, + _FormInfo formInfo, ) { - debugPrint('[DEBUG] change password both=$both'); + debugPrint('[DEBUG] change password both=$formInfo'); ChangePasswordState resultToState(UnitResult result) { debugPrint('[DEBUG] change password result=$result'); @@ -153,7 +154,8 @@ class ChangePasswordBloc extends DisposeCallbackBaseBloc { ); } - return changePassword(password: both.item1, newPassword: both.item2) + return changePassword( + password: formInfo.password, newPassword: formInfo.newPassword) .map(resultToState) .startWith( ChangePasswordState((b) => b diff --git a/lib/pages/home/change_password/change_password_bottomsheet.dart b/lib/pages/home/change_password/change_password_bottomsheet.dart index 53b3d83..12852ee 100644 --- a/lib/pages/home/change_password/change_password_bottomsheet.dart +++ b/lib/pages/home/change_password/change_password_bottomsheet.dart @@ -6,7 +6,7 @@ import 'package:node_auth/widgets/password_textfield.dart'; import 'package:rxdart_ext/rxdart_ext.dart'; class ChangePasswordBottomSheet extends StatefulWidget { - const ChangePasswordBottomSheet({Key? key}) : super(key: key); + const ChangePasswordBottomSheet({super.key}); @override State createState() => diff --git a/lib/pages/home/change_password/change_password_state.g.dart b/lib/pages/home/change_password/change_password_state.g.dart index c3a5c0f..5c9a6cf 100644 --- a/lib/pages/home/change_password/change_password_state.g.dart +++ b/lib/pages/home/change_password/change_password_state.g.dart @@ -44,8 +44,12 @@ class _$ChangePasswordState extends ChangePasswordState { @override int get hashCode { - return $jf( - $jc($jc($jc(0, error.hashCode), message.hashCode), isLoading.hashCode)); + var _$hash = 0; + _$hash = $jc(_$hash, error.hashCode); + _$hash = $jc(_$hash, message.hashCode); + _$hash = $jc(_$hash, isLoading.hashCode); + _$hash = $jf(_$hash); + return _$hash; } @override @@ -113,4 +117,4 @@ class ChangePasswordStateBuilder } } -// ignore_for_file: always_put_control_body_on_new_line,always_specify_types,annotate_overrides,avoid_annotating_with_dynamic,avoid_as,avoid_catches_without_on_clauses,avoid_returning_this,deprecated_member_use_from_same_package,lines_longer_than_80_chars,no_leading_underscores_for_local_identifiers,omit_local_variable_types,prefer_expression_function_bodies,sort_constructors_first,test_types_in_equals,unnecessary_const,unnecessary_new,unnecessary_lambdas +// ignore_for_file: deprecated_member_use_from_same_package,type=lint diff --git a/lib/pages/home/home_page.dart b/lib/pages/home/home_page.dart index 25fe5bb..6d4093b 100644 --- a/lib/pages/home/home_page.dart +++ b/lib/pages/home/home_page.dart @@ -1,3 +1,5 @@ +// ignore_for_file: use_build_context_synchronously + import 'dart:async'; import 'package:flutter/material.dart'; @@ -15,7 +17,7 @@ import 'package:rxdart_ext/rxdart_ext.dart'; class HomePage extends StatefulWidget { static const routeName = '/home_page'; - const HomePage({Key? key}) : super(key: key); + const HomePage({super.key}); @override State createState() => _HomePageState(); @@ -132,41 +134,37 @@ class _HomePageState extends State Stream handleMessage(HomeMessage message) async* { debugPrint('[DEBUG] homeBloc message=$message'); - if (message is LogoutMessage) { - if (message is LogoutSuccessMessage) { - context.showSnackBar('Logout successfully!'); - await delay(1000); - yield null; - - // ignore: use_build_context_synchronously - context.hideCurrentSnackBar(); - // ignore: use_build_context_synchronously - await Navigator.of(context).pushNamedAndRemoveUntil( - LoginPage.routeName, - (_) => false, - ); - return; - } - if (message is LogoutErrorMessage) { - context.showSnackBar('Error when logout: ${message.message}'); - return; - } - return; - } - if (message is UpdateAvatarMessage) { - if (message is UpdateAvatarSuccessMessage) { - context.showSnackBar('Upload image successfully!'); - return; - } - if (message is UpdateAvatarErrorMessage) { - context.showSnackBar('Error when upload image: ${message.message}'); - return; - } + switch (message) { + case LogoutMessage(): + switch (message) { + case LogoutSuccessMessage(): + context.showSnackBar('Logout successfully!'); + await delay(1000); + yield null; + + context.hideCurrentSnackBar(); + await Navigator.of(context).pushNamedAndRemoveUntil( + LoginPage.routeName, + (_) => false, + ); + + case LogoutErrorMessage(): + context.showSnackBar('Error when logout: ${message.message}'); + } + + case UpdateAvatarMessage(): + switch (message) { + case UpdateAvatarSuccessMessage(): + context.showSnackBar('Upload image successfully!'); + + case UpdateAvatarErrorMessage(): + context.showSnackBar('Error when upload image: ${message.message}'); + } } } void showChangePassword() { - showModalBottomSheet( + showModalBottomSheet( isScrollControlled: true, shape: const RoundedRectangleBorder( borderRadius: BorderRadius.only( diff --git a/lib/pages/home/home_profile_widget.dart b/lib/pages/home/home_profile_widget.dart index 03cf5f4..eaf3bcc 100644 --- a/lib/pages/home/home_profile_widget.dart +++ b/lib/pages/home/home_profile_widget.dart @@ -8,7 +8,7 @@ import 'package:node_auth/pages/home/home_bloc.dart'; import 'package:octo_image/octo_image.dart'; class HomeUserProfile extends StatelessWidget { - const HomeUserProfile({Key? key}) : super(key: key); + const HomeUserProfile({super.key}); @override Widget build(BuildContext context) { @@ -151,7 +151,7 @@ class HomeUserProfile extends StatelessWidget { } class ImageUploadingWidget extends StatelessWidget { - const ImageUploadingWidget({Key? key}) : super(key: key); + const ImageUploadingWidget({super.key}); @override Widget build(BuildContext context) { diff --git a/lib/pages/home/home_state.dart b/lib/pages/home/home_state.dart index 6ae82a9..32e5599 100644 --- a/lib/pages/home/home_state.dart +++ b/lib/pages/home/home_state.dart @@ -1,11 +1,11 @@ import 'package:meta/meta.dart'; @immutable -abstract class HomeMessage {} +sealed class HomeMessage {} -abstract class LogoutMessage implements HomeMessage {} +sealed class LogoutMessage implements HomeMessage {} -abstract class UpdateAvatarMessage implements HomeMessage {} +sealed class UpdateAvatarMessage implements HomeMessage {} /// /// diff --git a/lib/pages/login/login_bloc.dart b/lib/pages/login/login_bloc.dart index a8c6aff..a8bb058 100644 --- a/lib/pages/login/login_bloc.dart +++ b/lib/pages/login/login_bloc.dart @@ -107,7 +107,7 @@ class LoginBloc extends DisposeCallbackBaseBloc { .distinct() .share(); - final subscriptions = { + final subscriptions = >{ 'emailError': emailError$, 'passwordError': passwordError$, 'isValidSubmit': isValidSubmit$, diff --git a/lib/pages/login/login_page.dart b/lib/pages/login/login_page.dart index 022ca5d..17fc000 100644 --- a/lib/pages/login/login_page.dart +++ b/lib/pages/login/login_page.dart @@ -1,3 +1,5 @@ +// ignore_for_file: use_build_context_synchronously + import 'dart:async'; import 'package:did_change_dependencies/did_change_dependencies.dart'; @@ -15,7 +17,7 @@ import 'package:rxdart_ext/rxdart_ext.dart'; class LoginPage extends StatefulWidget { static const routeName = '/login_page'; - const LoginPage({Key? key}) : super(key: key); + const LoginPage({super.key}); @override State createState() => _MyLoginPageState(); @@ -144,25 +146,21 @@ class _MyLoginPageState extends State ); } - Stream handleMessage(message) async* { - if (message is LoginSuccessMessage) { - context.showSnackBar('Login successfully'); - await delay(1000); - yield null; + Stream handleMessage(LoginMessage message) async* { + switch (message) { + case LoginSuccessMessage(): + context.showSnackBar('Login successfully'); + await delay(1000); + yield null; - // ignore: use_build_context_synchronously - context.hideCurrentSnackBar(); - // ignore: use_build_context_synchronously - await Navigator.of(context).pushReplacementNamed(HomePage.routeName); - return; - } - if (message is LoginErrorMessage) { - context.showSnackBar(message.message); - return; - } - if (message is InvalidInformationMessage) { - context.showSnackBar('Invalid information'); - return; + context.hideCurrentSnackBar(); + await Navigator.of(context).pushReplacementNamed(HomePage.routeName); + + case LoginErrorMessage(): + context.showSnackBar(message.message); + + case InvalidInformationMessage(): + context.showSnackBar('Invalid information'); } } @@ -268,7 +266,6 @@ class _MyLoginPageState extends State if (email != null && email is String) { emailController.text = email; loginBloc.emailChanged(email); - // ignore: use_build_context_synchronously FocusScope.of(context).requestFocus(passwordFocusNode); } }, @@ -295,7 +292,6 @@ class _MyLoginPageState extends State if (email != null && email is String) { emailController.text = email; loginBloc.emailChanged(email); - // ignore: use_build_context_synchronously FocusScope.of(context).requestFocus(passwordFocusNode); } }, diff --git a/lib/pages/login/login_state.dart b/lib/pages/login/login_state.dart index f8fc592..559f78c 100644 --- a/lib/pages/login/login_state.dart +++ b/lib/pages/login/login_state.dart @@ -12,7 +12,7 @@ class Credential { } @immutable -abstract class LoginMessage {} +sealed class LoginMessage {} class LoginSuccessMessage implements LoginMessage { const LoginSuccessMessage(); diff --git a/lib/pages/register/register_bloc.dart b/lib/pages/register/register_bloc.dart index c189de6..caaa8cf 100644 --- a/lib/pages/register/register_bloc.dart +++ b/lib/pages/register/register_bloc.dart @@ -125,7 +125,7 @@ class RegisterBloc extends DisposeCallbackBaseBloc { .distinct() .share(); - final subscriptions = { + final subscriptions = >{ 'emailError': emailError$, 'passwordError': passwordError$, 'nameError': nameError$, diff --git a/lib/pages/register/register_page.dart b/lib/pages/register/register_page.dart index 60736b2..095ac23 100644 --- a/lib/pages/register/register_page.dart +++ b/lib/pages/register/register_page.dart @@ -1,3 +1,5 @@ +// ignore_for_file: use_build_context_synchronously + import 'dart:async'; import 'package:did_change_dependencies/did_change_dependencies.dart'; @@ -12,7 +14,7 @@ import 'package:rxdart_ext/rxdart_ext.dart'; class RegisterPage extends StatefulWidget { static const routeName = '/register_page'; - const RegisterPage({Key? key}) : super(key: key); + const RegisterPage({super.key}); @override State createState() => _RegisterPageState(); @@ -141,21 +143,18 @@ class _RegisterPageState extends State } Stream handleMessage(RegisterMessage message) async* { - if (message is RegisterSuccessMessage) { - context.showSnackBar('Register successfully'); - await delay(1000); - yield null; - // ignore: use_build_context_synchronously - Navigator.pop(context, message.email); - return; - } - if (message is RegisterErrorMessage) { - context.showSnackBar(message.message); - return; - } - if (message is RegisterInvalidInformationMessage) { - context.showSnackBar('Invalid information'); - return; + switch (message) { + case RegisterSuccessMessage(): + context.showSnackBar('Register successfully'); + await delay(1000); + yield null; + Navigator.pop(context, message.email); + + case RegisterErrorMessage(): + context.showSnackBar(message.message); + + case RegisterInvalidInformationMessage(): + context.showSnackBar('Invalid information'); } } diff --git a/lib/pages/register/register_state.dart b/lib/pages/register/register_state.dart index e221ee1..213d660 100644 --- a/lib/pages/register/register_state.dart +++ b/lib/pages/register/register_state.dart @@ -10,7 +10,7 @@ class RegisterUser { } @immutable -abstract class RegisterMessage {} +sealed class RegisterMessage {} class RegisterInvalidInformationMessage implements RegisterMessage { const RegisterInvalidInformationMessage(); diff --git a/lib/pages/reset_password/input_token/input_token_and_reset_password_bloc.dart b/lib/pages/reset_password/input_token/input_token_and_reset_password_bloc.dart index 02e8845..2c87202 100644 --- a/lib/pages/reset_password/input_token/input_token_and_reset_password_bloc.dart +++ b/lib/pages/reset_password/input_token/input_token_and_reset_password_bloc.dart @@ -2,13 +2,14 @@ import 'dart:async'; import 'package:disposebag/disposebag.dart'; import 'package:flutter_bloc_pattern/flutter_bloc_pattern.dart'; +import 'package:meta/meta.dart'; import 'package:node_auth/domain/usecases/reset_password_use_case.dart'; import 'package:node_auth/utils/type_defs.dart'; import 'package:node_auth/utils/validators.dart'; import 'package:rxdart_ext/rxdart_ext.dart'; -import 'package:tuple/tuple.dart'; -abstract class InputTokenAndResetPasswordMessage {} +@immutable +sealed class InputTokenAndResetPasswordMessage {} class InvalidInformation implements InputTokenAndResetPasswordMessage { const InvalidInformation(); @@ -27,6 +28,8 @@ class ResetPasswordFailure implements InputTokenAndResetPasswordMessage { const ResetPasswordFailure(this.error, this.message); } +typedef _FormInfo = ({String email, String token, String newPassword}); + //ignore_for_file: close_sinks class InputTokenAndResetPasswordBloc extends DisposeCallbackBaseBloc { @@ -87,26 +90,30 @@ class InputTokenAndResetPasswordBloc extends DisposeCallbackBaseBloc { return 'Token must be not empty'; }).share(); - final allField$ = submitSubject - .map((_) => Tuple3( - emailSubject.value, tokenSubject.value, passwordSubject.value)) + final Stream<_FormInfo> allField$ = submitSubject + .map( + (_) => ( + email: emailSubject.value, + token: tokenSubject.value, + newPassword: passwordSubject.value + ), + ) .share(); - bool allFieldsAreValid(Tuple3 tuple3) { - return Validator.isValidEmail(tuple3.item1) && - tuple3.item2.isNotEmpty && - Validator.isValidPassword(tuple3.item3); - } + bool allFieldsAreValid(_FormInfo formInfo) => + Validator.isValidEmail(formInfo.email) && + formInfo.token.isNotEmpty && + Validator.isValidPassword(formInfo.newPassword); final message$ = Rx.merge([ allField$ - .where((tuple3) => !allFieldsAreValid(tuple3)) + .where((formInfo) => !allFieldsAreValid(formInfo)) .map((_) => const InvalidInformation()), allField$ .where(allFieldsAreValid) - .exhaustMap((tuple3) => _sendResetPasswordRequest( + .exhaustMap((formInfo) => _sendResetPasswordRequest( resetPassword, - tuple3, + formInfo, isLoadingSubject, )), ]).whereNotNull().share(); @@ -127,17 +134,13 @@ class InputTokenAndResetPasswordBloc extends DisposeCallbackBaseBloc { static Stream _sendResetPasswordRequest( ResetPasswordUseCase resetPassword, - Tuple3 tuple3, + _FormInfo formInfo, Sink isLoadingSink, ) { - final email = tuple3.item1; - final token = tuple3.item2; - final newPassword = tuple3.item3; - return resetPassword( - email: email, - token: token, - newPassword: newPassword, + email: formInfo.email, + token: formInfo.token, + newPassword: formInfo.newPassword, ) .doOn( listen: () => isLoadingSink.add(true), @@ -145,7 +148,7 @@ class InputTokenAndResetPasswordBloc extends DisposeCallbackBaseBloc { ) .map( (result) => result.fold( - ifRight: (_) => ResetPasswordSuccess(email), + ifRight: (_) => ResetPasswordSuccess(formInfo.email), ifLeft: (appError) => appError.isCancellation ? null : ResetPasswordFailure(appError.error!, appError.message!), diff --git a/lib/pages/reset_password/input_token/input_token_and_reset_password_page.dart b/lib/pages/reset_password/input_token/input_token_and_reset_password_page.dart index fbc85e6..b1aca93 100644 --- a/lib/pages/reset_password/input_token/input_token_and_reset_password_page.dart +++ b/lib/pages/reset_password/input_token/input_token_and_reset_password_page.dart @@ -9,8 +9,7 @@ import 'package:rxdart_ext/rxdart_ext.dart'; class InputTokenAndResetPasswordPage extends StatefulWidget { final VoidCallback toggle; - const InputTokenAndResetPasswordPage({Key? key, required this.toggle}) - : super(key: key); + const InputTokenAndResetPasswordPage({super.key, required this.toggle}); @override State createState() => diff --git a/lib/pages/reset_password/reset_password_page.dart b/lib/pages/reset_password/reset_password_page.dart index dfd4f87..a66d607 100644 --- a/lib/pages/reset_password/reset_password_page.dart +++ b/lib/pages/reset_password/reset_password_page.dart @@ -13,7 +13,7 @@ import 'package:rxdart_ext/rxdart_ext.dart'; class ResetPasswordPage extends StatefulWidget { static const routeName = '/reset_password_page'; - const ResetPasswordPage({Key? key}) : super(key: key); + const ResetPasswordPage({super.key}); @override State createState() => _ResetPasswordPageState(); diff --git a/lib/pages/reset_password/send_email/send_email_page.dart b/lib/pages/reset_password/send_email/send_email_page.dart index 8407c2d..84a1b3c 100644 --- a/lib/pages/reset_password/send_email/send_email_page.dart +++ b/lib/pages/reset_password/send_email/send_email_page.dart @@ -7,7 +7,7 @@ import 'package:node_auth/utils/snackbar.dart'; class SendEmailPage extends StatefulWidget { final VoidCallback toggle; - const SendEmailPage({Key? key, required this.toggle}) : super(key: key); + const SendEmailPage({super.key, required this.toggle}); @override State createState() => _SendEmailPageState(); @@ -168,15 +168,11 @@ class _SendEmailPageState extends State } static String _getMessageString(SendEmailMessage msg) { - if (msg is SendEmailInvalidInformationMessage) { - return 'Invalid information. Try again'; - } - if (msg is SendEmailSuccessMessage) { - return 'Email sent. Check your email inbox and go to reset password page'; - } - if (msg is SendEmailErrorMessage) { - return msg.message; - } - return 'An unexpected error has occurred'; + return switch (msg) { + SendEmailInvalidInformationMessage() => 'Invalid information. Try again', + SendEmailSuccessMessage() => + 'Email sent. Check your email inbox and go to reset password page', + SendEmailErrorMessage() => msg.message, + }; } } diff --git a/lib/pages/reset_password/send_email/send_email_state.dart b/lib/pages/reset_password/send_email/send_email_state.dart index 12c51c1..8abd3da 100644 --- a/lib/pages/reset_password/send_email/send_email_state.dart +++ b/lib/pages/reset_password/send_email/send_email_state.dart @@ -1,4 +1,7 @@ -abstract class SendEmailMessage {} +import 'package:meta/meta.dart'; + +@immutable +sealed class SendEmailMessage {} class SendEmailInvalidInformationMessage implements SendEmailMessage { const SendEmailInvalidInformationMessage(); diff --git a/lib/utils/result.dart b/lib/utils/result.dart deleted file mode 100644 index 8b13789..0000000 --- a/lib/utils/result.dart +++ /dev/null @@ -1 +0,0 @@ - diff --git a/lib/utils/streams.dart b/lib/utils/streams.dart index a2f4519..d5bd7d4 100644 --- a/lib/utils/streams.dart +++ b/lib/utils/streams.dart @@ -10,7 +10,7 @@ extension AsUnitSingleExtension on Single> { } extension DebugMapStreamsExtension on Map> { - List debug() => entries + List> debug() => entries .map((entry) => entry.value .listen((data) => debugPrint('[DEBUG] [${entry.key}] = $data'))) .toList(); diff --git a/lib/widgets/password_textfield.dart b/lib/widgets/password_textfield.dart index 089e7d7..769c107 100644 --- a/lib/widgets/password_textfield.dart +++ b/lib/widgets/password_textfield.dart @@ -9,14 +9,14 @@ class PasswordTextField extends StatefulWidget { final FocusNode? focusNode; const PasswordTextField({ - Key? key, + super.key, required this.onChanged, required this.errorText, required this.labelText, required this.onSubmitted, required this.textInputAction, required this.focusNode, - }) : super(key: key); + }); @override State createState() => _PasswordTextFieldState(); diff --git a/pubspec.lock b/pubspec.lock index 92ba5a7..0b90710 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -5,26 +5,26 @@ packages: dependency: transitive description: name: _fe_analyzer_shared - sha256: "3444216bfd127af50bbe4862d8843ed44db946dd933554f0d7285e89f10e28ac" + sha256: ae92f5d747aee634b87f89d9946000c2de774be1d6ac3e58268224348cd0101a url: "https://pub.dev" source: hosted - version: "50.0.0" + version: "61.0.0" analyzer: dependency: "direct dev" description: name: analyzer - sha256: "68796c31f510c8455a06fed75fc97d8e5ad04d324a830322ab3efc9feb6201c1" + sha256: ea3d8652bda62982addfd92fdc2d0214e5f82e43325104990d4f4c4a2a313562 url: "https://pub.dev" source: hosted - version: "5.2.0" + version: "5.13.0" args: dependency: transitive description: name: args - sha256: "0bd9a99b6eb96f07af141f0eb53eace8983e8e5aa5de59777aca31684680ef22" + sha256: "7cf60b9f0cc88203c5a190b4cd62a99feea42759a7fa695010eb5de1c0b2252a" url: "https://pub.dev" source: hosted - version: "2.3.0" + version: "2.5.0" async: dependency: transitive description: @@ -45,50 +45,50 @@ packages: dependency: transitive description: name: build - sha256: "3fbda25365741f8251b39f3917fb3c8e286a96fd068a5a242e11c2012d495777" + sha256: "80184af8b6cb3e5c1c4ec6d8544d27711700bc3e6d2efad04238c7b5290889f0" url: "https://pub.dev" source: hosted - version: "2.3.1" + version: "2.4.1" build_config: dependency: transitive description: name: build_config - sha256: "5b7355c14258f5e7df24bad1566f7b991de3e54aeacfb94e1a65e5233d9739c1" + sha256: bf80fcfb46a29945b423bd9aad884590fb1dc69b330a4d4700cac476af1708d1 url: "https://pub.dev" source: hosted - version: "1.1.0" + version: "1.1.1" build_daemon: dependency: transitive description: name: build_daemon - sha256: "6bc5544ea6ce4428266e7ea680e945c68806c4aae2da0eb5e9ccf38df8d6acbf" + sha256: "79b2aef6ac2ed00046867ed354c88778c9c0f029df8a20fe10b5436826721ef9" url: "https://pub.dev" source: hosted - version: "3.1.0" + version: "4.0.2" build_resolvers: dependency: transitive description: name: build_resolvers - sha256: "7c35a3a7868626257d8aee47b51c26b9dba11eaddf3431117ed2744951416aab" + sha256: "339086358431fa15d7eca8b6a36e5d783728cf025e559b834f4609a1fcfb7b0a" url: "https://pub.dev" source: hosted - version: "2.1.0" + version: "2.4.2" build_runner: dependency: "direct dev" description: name: build_runner - sha256: "6f48c61a9dcd2c3a9e62d3dcdab1ba382790e2f31026288cbabe55d6003c9c23" + sha256: "644dc98a0f179b872f612d3eb627924b578897c629788e858157fa5e704ca0c7" url: "https://pub.dev" source: hosted - version: "2.3.2" + version: "2.4.11" build_runner_core: dependency: transitive description: name: build_runner_core - sha256: f4d6244cc071ba842c296cb1c4ee1b31596b9f924300647ac7a1445493471a3f + sha256: e3c79f69a64bdfcd8a776a3c28db4eb6e3fb5356d013ae5eb2e52007706d5dbe url: "https://pub.dev" source: hosted - version: "7.2.3" + version: "7.3.1" built_collection: dependency: transitive description: @@ -101,26 +101,26 @@ packages: dependency: "direct main" description: name: built_value - sha256: "59e08b0079bb75f7e27392498e26339387c1089c6bd58525a14eb8508637277b" + sha256: c7913a9737ee4007efedaffc968c049fd0f3d0e49109e778edc10de9426005cb url: "https://pub.dev" source: hosted - version: "8.4.2" + version: "8.9.2" built_value_generator: dependency: "direct dev" description: name: built_value_generator - sha256: "02e0a7ef29d2aaba8fdefdd7cea8dd672de234635d8753be7be6faff46839390" + sha256: bb06c5e9dbdbd35ed6de21520e2e5112582c964fa584e2a4bb59887fc7a169b0 url: "https://pub.dev" source: hosted - version: "8.4.2" + version: "8.9.2" cancellation_token_hoc081098: dependency: "direct main" description: name: cancellation_token_hoc081098 - sha256: "21f24807159afdc4229a2a53f26a72026a3e92a1812b5dbdcaa467673311c41f" + sha256: ddc12a15f9b8a1256e6cefddc9011ddccfeb05188473b26ba3eddd20ac297aea url: "https://pub.dev" source: hosted - version: "1.0.0" + version: "2.0.0" characters: dependency: transitive description: @@ -129,22 +129,14 @@ packages: url: "https://pub.dev" source: hosted version: "1.3.0" - charcode: - dependency: transitive - description: - name: charcode - sha256: fb98c0f6d12c920a02ee2d998da788bca066ca5f148492b7085ee23372b12306 - url: "https://pub.dev" - source: hosted - version: "1.3.1" checked_yaml: dependency: transitive description: name: checked_yaml - sha256: dd007e4fb8270916820a0d66e24f619266b60773cddd082c6439341645af2659 + sha256: feb6bed21949061731a7a75fc5d2aa727cf160b91af9a3e464c5e3a32e28b5ff url: "https://pub.dev" source: hosted - version: "2.0.1" + version: "2.0.3" clock: dependency: transitive description: @@ -157,10 +149,10 @@ packages: dependency: transitive description: name: code_builder - sha256: "02ce3596b459c666530f045ad6f96209474e8fee6e4855940a3cee65fb872ec5" + sha256: f692079e25e7869c14132d39f223f8eec9830eb76131925143b2129c4bb01b37 url: "https://pub.dev" source: hosted - version: "4.3.0" + version: "4.10.0" collection: dependency: transitive description: @@ -173,58 +165,58 @@ packages: dependency: transitive description: name: convert - sha256: f08428ad63615f96a27e34221c65e1a451439b5f26030f78d790f461c686d65d + sha256: "0f08b14755d163f6e2134cb58222dd25ea2a2ee8a195e53983d57c075324d592" url: "https://pub.dev" source: hosted - version: "3.0.1" + version: "3.1.1" cross_file: dependency: transitive description: name: cross_file - sha256: "552ffd2f851d4314958e6265452af1891959e00cd32b6d17452c5b836e27a0fa" + sha256: "7caf6a750a0c04effbb52a676dce9a4a592e10ad35c34d6d2d0e4811160d5670" url: "https://pub.dev" source: hosted - version: "0.3.2" + version: "0.3.4+2" crypto: dependency: transitive description: name: crypto - sha256: cf75650c66c0316274e21d7c43d3dea246273af5955bd94e8184837cd577575c + sha256: ec30d999af904f33454ba22ed9a86162b35e52b44ac4807d1d93c288041d7d27 url: "https://pub.dev" source: hosted - version: "3.0.1" + version: "3.0.5" cupertino_http: dependency: "direct main" description: name: cupertino_http - sha256: a9ea56939f7d1d702619752e17bc81949d45b1cc80b7623e98ed2a63b0377229 + sha256: "7e75c45a27cc13a886ab0a1e4d8570078397057bd612de9d24fe5df0d9387717" url: "https://pub.dev" source: hosted - version: "0.0.10" + version: "1.5.1" cupertino_icons: dependency: "direct main" description: name: cupertino_icons - sha256: e35129dc44c9118cee2a5603506d823bab99c68393879edb440e0090d07586be + sha256: ba631d1c7f7bef6b729a622b7b752645a2d076dba9976925b8f25725a30e1ee6 url: "https://pub.dev" source: hosted - version: "1.0.5" + version: "1.0.8" dart_either: dependency: "direct main" description: name: dart_either - sha256: "928895b8266ac5906eb4e2993fead563a73b17fc86eec6b40172100d56ca2507" + sha256: "2c6f9bb4426c2f9e5109ca72e132e9d4f858167f9750dabd24a30c992c90db78" url: "https://pub.dev" source: hosted - version: "1.0.0" + version: "2.0.0" dart_style: dependency: transitive description: name: dart_style - sha256: "7a03456c3490394c8e7665890333e91ae8a49be43542b616e414449ac358acd4" + sha256: "1efa911ca7086affd35f463ca2fc1799584fb6aa89883cf0af8e3664d6a02d55" url: "https://pub.dev" source: hosted - version: "2.2.4" + version: "2.3.2" did_change_dependencies: dependency: "direct main" description: @@ -253,26 +245,58 @@ packages: dependency: transitive description: name: ffi - sha256: a38574032c5f1dd06c4aee541789906c12ccaab8ba01446e800d9c5b79c4a978 + sha256: "16ed7b077ef01ad6170a3d0c57caa4a112a38d7a2ed5602e0aca9ca6f3d98da6" url: "https://pub.dev" source: hosted - version: "2.0.1" + version: "2.1.3" file: dependency: transitive description: name: file - sha256: b69516f2c26a5bcac4eee2e32512e1a5205ab312b3536c1c1227b2b942b5f9ad + sha256: "5fc22d7c25582e38ad9a8515372cd9a93834027aacf1801cf01164dac0ffa08c" + url: "https://pub.dev" + source: hosted + version: "7.0.0" + file_selector_linux: + dependency: transitive + description: + name: file_selector_linux + sha256: "045d372bf19b02aeb69cacf8b4009555fb5f6f0b7ad8016e5f46dd1387ddd492" + url: "https://pub.dev" + source: hosted + version: "0.9.2+1" + file_selector_macos: + dependency: transitive + description: + name: file_selector_macos + sha256: f42eacb83b318e183b1ae24eead1373ab1334084404c8c16e0354f9a3e55d385 + url: "https://pub.dev" + source: hosted + version: "0.9.4" + file_selector_platform_interface: + dependency: transitive + description: + name: file_selector_platform_interface + sha256: a3994c26f10378a039faa11de174d7b78eb8f79e4dd0af2a451410c1a5c3f66b url: "https://pub.dev" source: hosted - version: "6.1.2" + version: "2.6.2" + file_selector_windows: + dependency: transitive + description: + name: file_selector_windows + sha256: "2ad726953f6e8affbc4df8dc78b77c3b4a060967a291e528ef72ae846c60fb69" + url: "https://pub.dev" + source: hosted + version: "0.9.3+2" fixnum: dependency: transitive description: name: fixnum - sha256: "6a2ef17156f4dc49684f9d99aaf4a93aba8ac49f5eac861755f5730ddf6e2e4e" + sha256: "25517a4deb0c03aa0f32fd12db525856438902d9c16536311e76cdc57b31d7d1" url: "https://pub.dev" source: hosted - version: "1.0.0" + version: "1.1.0" flutter: dependency: "direct main" description: flutter @@ -282,18 +306,10 @@ packages: dependency: "direct main" description: name: flutter_bloc_pattern - sha256: "76fc4e7cd79cfe770ca69a0ea8133cf1ac180ecf42e86d316db3693fcd871501" - url: "https://pub.dev" - source: hosted - version: "2.3.0" - flutter_blurhash: - dependency: transitive - description: - name: flutter_blurhash - sha256: "1a4a4973320803a24b68596c755500c0e55dc02007038257a2a98dffc196a4ed" + sha256: "934b42da57797a759b62659bb157625749f602239c26f13adde7c61ee65d3e3f" url: "https://pub.dev" source: hosted - version: "0.6.4" + version: "3.0.0" flutter_disposebag: dependency: "direct main" description: @@ -306,18 +322,18 @@ packages: dependency: "direct dev" description: name: flutter_lints - sha256: aeb0b80a8b3709709c9cc496cdc027c5b3216796bc0af0ce1007eaf24464fd4c + sha256: "3f41d009ba7172d5ff9be5f6e6e6abb4300e263aab8866d2a0842ed2a70f8f0c" url: "https://pub.dev" source: hosted - version: "2.0.1" + version: "4.0.0" flutter_plugin_android_lifecycle: dependency: transitive description: name: flutter_plugin_android_lifecycle - sha256: "5c574d21b98ec92adab05ead10afd2b13ff5856c7ca79696edb338a9dd8ed387" + sha256: "9ee02950848f61c4129af3d6ec84a1cfc0e47931abc746b03e7a3bc3e8ff6eda" url: "https://pub.dev" source: hosted - version: "2.0.5" + version: "2.0.22" flutter_provider: dependency: "direct main" description: @@ -340,122 +356,154 @@ packages: dependency: transitive description: name: frontend_server_client - sha256: "82715f8041a85a534a7bf64400b2ee0bb3d594ccf695d97c0bb017259657ff5d" + sha256: f64a0333a82f30b0cca061bc3d143813a486dc086b574bfb233b7c1372427694 url: "https://pub.dev" source: hosted - version: "3.1.0" + version: "4.0.0" glob: dependency: transitive description: name: glob - sha256: "8321dd2c0ab0683a91a51307fa844c6db4aa8e3981219b78961672aaab434658" + sha256: "0e7014b3b7d4dac1ca4d6114f82bf1782ee86745b9b42a92c9289c23d8a0ab63" url: "https://pub.dev" source: hosted - version: "2.0.2" + version: "2.1.2" graphs: dependency: transitive description: name: graphs - sha256: ae0b3d956ff324c6f8671f08dcb2dbd71c99cdbf2aa3ca63a14190c47aa6679c + sha256: "741bbf84165310a68ff28fe9e727332eef1407342fca52759cb21ad8177bb8d0" url: "https://pub.dev" source: hosted - version: "2.1.0" + version: "2.3.2" http: dependency: "direct main" description: name: http - sha256: "6aa2946395183537c8b880962d935877325d6a09a2867c3970c05c0fed6ac482" + sha256: b9c29a161230ee03d3ccf545097fccd9b87a5264228c5d348202e0f0c28f9010 url: "https://pub.dev" source: hosted - version: "0.13.5" + version: "1.2.2" http_client_hoc081098: dependency: "direct main" description: name: http_client_hoc081098 - sha256: "2b624d62e7c3a28c59deeaf1b72dcc8bd9de9ac129a7d5ebaa7fc3cbbae2f2e2" + sha256: b6c6c10e3dc5846548c037c163f4bfc67486ceeb06d1458f42591bda1b31405b url: "https://pub.dev" source: hosted - version: "0.0.1-dev.0" + version: "0.1.0" http_multi_server: dependency: transitive description: name: http_multi_server - sha256: ab298ef2b2acd283bd36837df7801dcf6e6b925f8da6e09efb81111230aa9037 + sha256: "97486f20f9c2f7be8f514851703d0119c3596d14ea63227af6f7a481ef2b2f8b" url: "https://pub.dev" source: hosted - version: "3.2.0" + version: "3.2.1" http_parser: dependency: transitive description: name: http_parser - sha256: e362d639ba3bc07d5a71faebb98cde68c05bfbcfbbb444b60b6f60bb67719185 + sha256: "2aa08ce0341cc9b354a498388e30986515406668dbcc4f7c950c3e715496693b" url: "https://pub.dev" source: hosted - version: "4.0.0" + version: "4.0.2" + http_profile: + dependency: transitive + description: + name: http_profile + sha256: "7e679e355b09aaee2ab5010915c932cce3f2d1c11c3b2dc177891687014ffa78" + url: "https://pub.dev" + source: hosted + version: "0.1.0" image_picker: dependency: "direct main" description: name: image_picker - sha256: a8f2f0aed50c03230ab37e93ca2905c50b6c4097245345956eb24a88f45328cd + sha256: "021834d9c0c3de46bf0fe40341fa07168407f694d9b2bb18d532dc1261867f7a" url: "https://pub.dev" source: hosted - version: "0.8.6" + version: "1.1.2" image_picker_android: dependency: transitive description: name: image_picker_android - sha256: "524c04b800320c92c079294a8a2024912b5cff6854d8e5da4d966338b243a276" + sha256: "8c5abf0dcc24fe6e8e0b4a5c0b51a5cf30cefdf6407a3213dae61edc75a70f56" url: "https://pub.dev" source: hosted - version: "0.8.4+13" + version: "0.8.12+12" image_picker_for_web: dependency: transitive description: name: image_picker_for_web - sha256: "837609ccdb538b6d255808f6920179af004f2fecd1eb529fb14d313c289a9333" + sha256: "869fe8a64771b7afbc99fc433a5f7be2fea4d1cb3d7c11a48b6b579eb9c797f0" url: "https://pub.dev" source: hosted - version: "2.1.6" + version: "2.2.0" image_picker_ios: dependency: transitive description: name: image_picker_ios - sha256: "1768087441bd69ca632249d212c26fa8d530552d37b4896a4dd8d6781435c147" + sha256: "6703696ad49f5c3c8356d576d7ace84d1faf459afb07accbb0fae780753ff447" + url: "https://pub.dev" + source: hosted + version: "0.8.12" + image_picker_linux: + dependency: transitive + description: + name: image_picker_linux + sha256: "4ed1d9bb36f7cd60aa6e6cd479779cc56a4cb4e4de8f49d487b1aaad831300fa" + url: "https://pub.dev" + source: hosted + version: "0.2.1+1" + image_picker_macos: + dependency: transitive + description: + name: image_picker_macos + sha256: "3f5ad1e8112a9a6111c46d0b57a7be2286a9a07fc6e1976fdf5be2bd31d4ff62" url: "https://pub.dev" source: hosted - version: "0.8.6+1" + version: "0.2.1+1" image_picker_platform_interface: dependency: transitive description: name: image_picker_platform_interface - sha256: "7cef2f28f4f2fef99180f636c3d446b4ccbafd6ba0fad2adc9a80c4040f656b8" + sha256: "9ec26d410ff46f483c5519c29c02ef0e02e13a543f882b152d4bfd2f06802f80" url: "https://pub.dev" source: hosted - version: "2.6.2" + version: "2.10.0" + image_picker_windows: + dependency: transitive + description: + name: image_picker_windows + sha256: "6ad07afc4eb1bc25f3a01084d28520496c4a3bb0cb13685435838167c9dcedeb" + url: "https://pub.dev" + source: hosted + version: "0.2.1+1" io: dependency: transitive description: name: io - sha256: "0d4c73c3653ab85bf696d51a9657604c900a370549196a91f33e4c39af760852" + sha256: "2ec25704aba361659e10e3e5f5d672068d332fc8ac516421d483a11e5cbd061e" url: "https://pub.dev" source: hosted - version: "1.0.3" + version: "1.0.4" js: dependency: transitive description: name: js - sha256: a5e201311cb08bf3912ebbe9a2be096e182d703f881136ec1e81a2338a9e120d + sha256: c1b2e9b5ea78c45e1a0788d29606ba27dc5f71f019f32ca5140f61ef071838cf url: "https://pub.dev" source: hosted - version: "0.6.4" + version: "0.7.1" json_annotation: dependency: transitive description: name: json_annotation - sha256: cb314f00b2488de7bc575207e54402cd2f92363f333a7933fd1b0631af226baa + sha256: "1ce844379ca14835a50d2f019a3099f419082cfdd231cd86a142af94dd5c6bb1" url: "https://pub.dev" source: hosted - version: "4.6.0" + version: "4.9.0" leak_tracker: dependency: transitive description: @@ -484,18 +532,18 @@ packages: dependency: transitive description: name: lints - sha256: "5cfd6509652ff5e7fe149b6df4859e687fca9048437857cb2e65c8d780f396e3" + sha256: "976c774dd944a42e83e2467f4cc670daef7eed6295b10b36ae8c85bcbf828235" url: "https://pub.dev" source: hosted - version: "2.0.0" + version: "4.0.0" logging: dependency: transitive description: name: logging - sha256: "293ae2d49fd79d4c04944c3a26dfd313382d5f52e821ec57119230ae16031ad4" + sha256: "623a88c9594aa774443aa3eb2d41807a48486b5613e67599fb4c41c0ad47c340" url: "https://pub.dev" source: hosted - version: "1.0.2" + version: "1.2.0" matcher: dependency: transitive description: @@ -524,26 +572,26 @@ packages: dependency: transitive description: name: mime - sha256: fd5f81041e6a9fc9b9d7fa2cb8a01123f9f5d5d49136e06cb9dc7d33689529f4 + sha256: "801fd0b26f14a4a58ccb09d5892c3fbdeff209594300a542492cf13fba9d247a" url: "https://pub.dev" source: hosted - version: "1.0.1" + version: "1.0.6" octo_image: dependency: "direct main" description: name: octo_image - sha256: "107f3ed1330006a3bea63615e81cf637433f5135a52466c7caa0e7152bca9143" + sha256: "34faa6639a78c7e3cbe79be6f9f96535867e879748ade7d17c9b1ae7536293bd" url: "https://pub.dev" source: hosted - version: "1.0.2" + version: "2.1.0" package_config: dependency: transitive description: name: package_config - sha256: a4d5ede5ca9c3d88a2fef1147a078570c861714c806485c596b109819135bc12 + sha256: "1c5b77ccc91e4823a5af61ee74e6b972db1ef98c2ff5a18d3161c982a55448bd" url: "https://pub.dev" source: hosted - version: "2.0.2" + version: "2.1.0" path: dependency: "direct main" description: @@ -556,186 +604,171 @@ packages: dependency: transitive description: name: path_provider_linux - sha256: ab0987bf95bc591da42dffb38c77398fc43309f0b9b894dcc5d6f40c4b26c379 + sha256: f7a1fe3a634fe7734c8d3f2766ad746ae2a2884abe22e241a8b301bf5cac3279 url: "https://pub.dev" source: hosted - version: "2.1.7" + version: "2.2.1" path_provider_platform_interface: dependency: transitive description: name: path_provider_platform_interface - sha256: "3dc0d51b07f85fec3746d9f4e8d31c73bb173cafa2e763f03f8df2e8d1878882" + sha256: "88f5779f72ba699763fa3a3b06aa4bf6de76c8e5de842cf6f29e2e06476c2334" url: "https://pub.dev" source: hosted - version: "2.0.3" + version: "2.1.2" path_provider_windows: dependency: transitive description: name: path_provider_windows - sha256: bcabbe399d4042b8ee687e17548d5d3f527255253b4a639f5f8d2094a9c2b45c + sha256: bd6f00dbd873bfb70d0761682da2b3a2c2fccc2b9e84c495821639601d81afe7 url: "https://pub.dev" source: hosted - version: "2.1.3" + version: "2.3.0" platform: dependency: transitive description: name: platform - sha256: "4a451831508d7d6ca779f7ac6e212b4023dd5a7d08a27a63da33756410e32b76" + sha256: "9b71283fc13df574056616011fb138fd3b793ea47cc509c189a6c3fa5f8a1a65" url: "https://pub.dev" source: hosted - version: "3.1.0" + version: "3.1.5" plugin_platform_interface: dependency: "direct dev" description: name: plugin_platform_interface - sha256: dbf0f707c78beedc9200146ad3cb0ab4d5da13c246336987be6940f026500d3a + sha256: "4820fbfdb9478b1ebae27888254d445073732dae3d6ea81f0b7e06d5dedc3f02" url: "https://pub.dev" source: hosted - version: "2.1.3" + version: "2.1.8" pool: dependency: transitive description: name: pool - sha256: "05955e3de2683e1746222efd14b775df7131139e07695dc8e24650f6b4204504" + sha256: "20fe868b6314b322ea036ba325e6fc0711a22948856475e2c2b6306e8ab39c2a" url: "https://pub.dev" source: hosted - version: "1.5.0" - process: - dependency: transitive - description: - name: process - sha256: "53fd8db9cec1d37b0574e12f07520d582019cb6c44abf5479a01505099a34a09" - url: "https://pub.dev" - source: hosted - version: "4.2.4" + version: "1.5.1" pub_semver: dependency: transitive description: name: pub_semver - sha256: b5a5fcc6425ea43704852ba4453ba94b08c2226c63418a260240c3a054579014 + sha256: "40d3ab1bbd474c4c2328c91e3a7df8c6dd629b79ece4c4bd04bee496a224fb0c" url: "https://pub.dev" source: hosted - version: "2.1.0" + version: "2.1.4" pubspec_parse: dependency: transitive description: name: pubspec_parse - sha256: "3686efe4a4613a4449b1a4ae08670aadbd3376f2e78d93e3f8f0919db02a7256" + sha256: c799b721d79eb6ee6fa56f00c04b472dcd44a30d258fac2174a6ec57302678f8 url: "https://pub.dev" source: hosted - version: "1.2.0" - quiver: - dependency: transitive - description: - name: quiver - sha256: "616b691d1c8f5c53b7b39ce3542f6a25308d7900bf689d0210e72a644a10387e" - url: "https://pub.dev" - source: hosted - version: "3.0.1+1" + version: "1.3.0" rx_shared_preferences: dependency: "direct main" description: name: rx_shared_preferences - sha256: "04926615be40bb55192ff81374e1541580102b54ff98e83a19d1e04bfb412b9c" + sha256: "4414a3988f58addf6cfe7932c3eb7589604010fd2d3466964abf2c2cfdf1f6ed" url: "https://pub.dev" source: hosted - version: "3.1.0" + version: "4.0.0" rx_storage: dependency: transitive description: name: rx_storage - sha256: "918d931ea5e285867f80526d6b64177c47e9636554fb4b38ec9c88e771aaaad7" + sha256: "06c73a6960eb49b410e26d55fcdec0a2c098314ddf6940dc2d499290ea8a930f" url: "https://pub.dev" source: hosted - version: "2.1.0" + version: "3.0.0" rxdart: dependency: "direct main" description: name: rxdart - sha256: "0c7c0cedd93788d996e33041ffecda924cc54389199cde4e6a34b440f50044cb" + sha256: "5c3004a4a8dbb94bd4bf5412a4def4acdaa12e12f269737a5751369e12d1a962" url: "https://pub.dev" source: hosted - version: "0.27.7" + version: "0.28.0" rxdart_ext: dependency: "direct main" description: - name: rxdart_ext - sha256: "95185739dff4124415b42eb491e00ad843006fd3626f8438d2153d7e63afbdb0" - url: "https://pub.dev" - source: hosted - version: "0.2.7" + path: "." + ref: "138c130651ed5b57127851cfc9817ad7377c806e" + resolved-ref: "138c130651ed5b57127851cfc9817ad7377c806e" + url: "https://github.com/hoc081098/rxdart_ext.git" + source: git + version: "0.4.0" shared_preferences: dependency: "direct main" description: name: shared_preferences - sha256: d3bbe5553a986e83980916ded2f0b435ef2e1893dfaa29d5a7a790d0eca12180 + sha256: "746e5369a43170c25816cc472ee016d3a66bc13fcf430c0bc41ad7b4b2922051" url: "https://pub.dev" source: hosted - version: "2.2.3" + version: "2.3.2" shared_preferences_android: dependency: transitive description: name: shared_preferences_android - sha256: "3d4571b3c5eb58ce52a419d86e655493d0bc3020672da79f72fa0c16ca3a8ec1" + sha256: "480ba4345773f56acda9abf5f50bd966f581dac5d514e5fc4a18c62976bbba7e" url: "https://pub.dev" source: hosted - version: "2.2.4" + version: "2.3.2" shared_preferences_foundation: dependency: transitive description: name: shared_preferences_foundation - sha256: "0a8a893bf4fd1152f93fec03a415d11c27c74454d96e2318a7ac38dd18683ab7" + sha256: c4b35f6cb8f63c147312c054ce7c2254c8066745125264f0c88739c417fc9d9f url: "https://pub.dev" source: hosted - version: "2.4.0" + version: "2.5.2" shared_preferences_linux: dependency: transitive description: name: shared_preferences_linux - sha256: "9f2cbcf46d4270ea8be39fa156d86379077c8a5228d9dfdb1164ae0bb93f1faa" + sha256: "580abfd40f415611503cae30adf626e6656dfb2f0cee8f465ece7b6defb40f2f" url: "https://pub.dev" source: hosted - version: "2.3.2" + version: "2.4.1" shared_preferences_platform_interface: dependency: transitive description: name: shared_preferences_platform_interface - sha256: d4ec5fc9ebb2f2e056c617112aa75dcf92fc2e4faaf2ae999caa297473f75d8a + sha256: "57cbf196c486bc2cf1f02b85784932c6094376284b3ad5779d1b1c6c6a816b80" url: "https://pub.dev" source: hosted - version: "2.3.1" + version: "2.4.1" shared_preferences_web: dependency: transitive description: name: shared_preferences_web - sha256: "9aee1089b36bd2aafe06582b7d7817fd317ef05fc30e6ba14bff247d0933042a" + sha256: d2ca4132d3946fec2184261726b355836a82c33d7d5b67af32692aff18a4684e url: "https://pub.dev" source: hosted - version: "2.3.0" + version: "2.4.2" shared_preferences_windows: dependency: transitive description: name: shared_preferences_windows - sha256: "841ad54f3c8381c480d0c9b508b89a34036f512482c407e6df7a9c4aa2ef8f59" + sha256: "94ef0f72b2d71bc3e700e025db3710911bd51a71cefb65cc609dd0d9a982e3c1" url: "https://pub.dev" source: hosted - version: "2.3.2" + version: "2.4.1" shelf: dependency: transitive description: name: shelf - sha256: c240984c924796e055e831a0a36db23be8cb04f170b26df572931ab36418421d + sha256: ad29c505aee705f41a4d8963641f91ac4cee3c8fad5947e033390a7bd8180fa4 url: "https://pub.dev" source: hosted - version: "1.2.0" + version: "1.4.1" shelf_web_socket: dependency: transitive description: name: shelf_web_socket - sha256: fd84910bf7d58db109082edf7326b75322b8f186162028482f53dc892f00332d + sha256: "073c147238594ecd0d193f3456a5fe91c4b0abbcc68bf5cd95b36c4e194ac611" url: "https://pub.dev" source: hosted - version: "1.0.1" + version: "2.0.0" sky_engine: dependency: transitive description: flutter @@ -745,10 +778,10 @@ packages: dependency: transitive description: name: source_gen - sha256: "2d79738b6bbf38a43920e2b8d189e9a3ce6cc201f4b8fc76be5e4fe377b1c38d" + sha256: "14658ba5f669685cd3d63701d01b31ea748310f7ab854e471962670abcf57832" url: "https://pub.dev" source: hosted - version: "1.2.6" + version: "1.5.0" source_span: dependency: transitive description: @@ -785,10 +818,10 @@ packages: dependency: transitive description: name: stream_transform - sha256: ed464977cb26a1f41537e177e190c67223dbd9f4f683489b6ab2e5d211ec564e + sha256: "14a00e794c7c11aa145a170587321aedce29769c08d7f58b1d141da75e3b1c6f" url: "https://pub.dev" source: hosted - version: "2.0.0" + version: "2.1.0" string_scanner: dependency: transitive description: @@ -817,26 +850,18 @@ packages: dependency: transitive description: name: timing - sha256: c386d07d7f5efc613479a7c4d9d64b03710b03cfaa7e8ad5f2bfb295a1f0dfad + sha256: "70a3b636575d4163c477e6de42f247a23b315ae20e86442bebe32d3cabf61c32" url: "https://pub.dev" source: hosted - version: "1.0.0" - tuple: - dependency: "direct main" - description: - name: tuple - sha256: "0ea99cd2f9352b2586583ab2ce6489d1f95a5f6de6fb9492faaf97ae2060f0aa" - url: "https://pub.dev" - source: hosted - version: "2.0.1" + version: "1.0.1" typed_data: dependency: transitive description: name: typed_data - sha256: "53bdf7e979cfbf3e28987552fd72f637e63f3c8724c9e56d9246942dc2fa36ee" + sha256: facc8d6582f16042dd49f2463ff1bd6e2c9ef9f3d5da3d9b087e244a7b564b3c url: "https://pub.dev" source: hosted - version: "1.3.0" + version: "1.3.2" vector_math: dependency: transitive description: @@ -857,50 +882,50 @@ packages: dependency: transitive description: name: watcher - sha256: e42dfcc48f67618344da967b10f62de57e04bae01d9d3af4c2596f3712a88c99 + sha256: "3d2ad6751b3c16cf07c7fca317a1413b3f26530319181b37e3b9039b84fc01d8" url: "https://pub.dev" source: hosted - version: "1.0.1" + version: "1.1.0" web: dependency: transitive description: name: web - sha256: "97da13628db363c635202ad97068d47c5b8aa555808e7a9411963c533b449b27" + sha256: d43c1d6b787bf0afad444700ae7f4db8827f701bc61c255ac8d328c6f4d52062 url: "https://pub.dev" source: hosted - version: "0.5.1" - web_socket_channel: + version: "1.0.0" + web_socket: dependency: transitive description: - name: web_socket_channel - sha256: "0c2ada1b1aeb2ad031ca81872add6be049b8cb479262c6ad3c4b0f9c24eaab2f" + name: web_socket + sha256: "3c12d96c0c9a4eec095246debcea7b86c0324f22df69893d538fcc6f1b8cce83" url: "https://pub.dev" source: hosted - version: "2.1.0" - win32: + version: "0.1.6" + web_socket_channel: dependency: transitive description: - name: win32 - sha256: "1952a663c0e34fbde55916010d54bbb249bf5f2583113c497602f0ee01c6faa4" + name: web_socket_channel + sha256: "9f187088ed104edd8662ca07af4b124465893caf063ba29758f97af57e61da8f" url: "https://pub.dev" source: hosted - version: "3.0.0" + version: "3.0.1" xdg_directories: dependency: transitive description: name: xdg_directories - sha256: "060b6e1c891d956f72b5ac9463466c37cce3fa962a921532fc001e86fe93438e" + sha256: faea9dee56b520b55a566385b84f2e8de55e7496104adada9962e0bd11bcff1d url: "https://pub.dev" source: hosted - version: "0.2.0+1" + version: "1.0.4" yaml: dependency: transitive description: name: yaml - sha256: "3cee79b1715110341012d27756d9bae38e650588acd38d3f3c610822e1337ace" + sha256: "75769501ea3489fca56601ff33454fe45507ea3bfb014161abc3b43ae25989d5" url: "https://pub.dev" source: hosted - version: "3.1.0" + version: "3.1.2" sdks: - dart: ">=3.4.0 <4.0.0" - flutter: ">=3.22.0" + dart: ">=3.4.3 <4.0.0" + flutter: ">=3.22.2" diff --git a/pubspec.yaml b/pubspec.yaml index 314f1ed..cb127cf 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -5,49 +5,54 @@ publish_to: 'none' version: 3.3.0+8 environment: - sdk: ">=2.18.2 <3.0.0" - flutter: ">=3.3.3" + sdk: ^3.4.3 + flutter: ">=3.22.2" dependencies: flutter: sdk: flutter - cupertino_icons: ^1.0.5 + cupertino_icons: ^1.0.8 - cupertino_http: ^0.0.10 - meta: ^1.8.0 + cupertino_http: ^1.5.1 + meta: ^1.12.0 path: ^1.8.2 - http: ^0.13.5 - built_value: ^8.4.2 - tuple: ^2.0.1 - rxdart: ^0.27.7 - image_picker: ^0.8.6 - shared_preferences: ^2.2.2 - octo_image: ^1.0.2 + http: ^1.2.2 + built_value: ^8.9.2 + rxdart: ^0.28.0 + image_picker: ^1.1.2 + shared_preferences: ^2.3.2 + octo_image: ^2.1.0 flutter_provider: ^2.1.0 - rx_shared_preferences: ^3.1.0 + rx_shared_preferences: ^4.0.0 disposebag: ^1.5.1 flutter_disposebag: ^1.1.0 - flutter_bloc_pattern: ^2.3.0 - rxdart_ext: ^0.2.7 + flutter_bloc_pattern: ^3.0.0 + rxdart_ext: ^0.3.0 did_change_dependencies: ^1.0.0 stream_loader: ^1.5.0 - dart_either: ^1.0.0 - http_client_hoc081098: ^0.0.1-dev.0 - cancellation_token_hoc081098: ^1.0.0 + dart_either: ^2.0.0 + http_client_hoc081098: ^0.1.0 + cancellation_token_hoc081098: ^2.0.0 dev_dependencies: plugin_platform_interface: ^2.1.3 flutter_test: sdk: flutter - build_runner: ^2.3.2 - built_value_generator: ^8.4.2 + build_runner: ^2.4.11 + built_value_generator: ^8.9.2 analyzer: ^5.2.0 - flutter_lints: ^2.0.1 + flutter_lints: ^4.0.0 flutter: uses-material-design: true assets: - assets/bg.jpg - assets/user.png + +dependency_overrides: + rxdart_ext: + git: + url: https://github.com/hoc081098/rxdart_ext.git + ref: 138c130651ed5b57127851cfc9817ad7377c806e \ No newline at end of file diff --git a/windows/flutter/generated_plugin_registrant.cc b/windows/flutter/generated_plugin_registrant.cc index 8b6d468..77ab7a0 100644 --- a/windows/flutter/generated_plugin_registrant.cc +++ b/windows/flutter/generated_plugin_registrant.cc @@ -6,6 +6,9 @@ #include "generated_plugin_registrant.h" +#include void RegisterPlugins(flutter::PluginRegistry* registry) { + FileSelectorWindowsRegisterWithRegistrar( + registry->GetRegistrarForPlugin("FileSelectorWindows")); } diff --git a/windows/flutter/generated_plugins.cmake b/windows/flutter/generated_plugins.cmake index b93c4c3..a423a02 100644 --- a/windows/flutter/generated_plugins.cmake +++ b/windows/flutter/generated_plugins.cmake @@ -3,6 +3,7 @@ # list(APPEND FLUTTER_PLUGIN_LIST + file_selector_windows ) list(APPEND FLUTTER_FFI_PLUGIN_LIST