diff --git a/example/pubspec.lock b/example/pubspec.lock index c663195..c22a987 100644 --- a/example/pubspec.lock +++ b/example/pubspec.lock @@ -7,7 +7,7 @@ packages: name: appwrite url: "https://pub.dartlang.org" source: hosted - version: "7.0.0" + version: "8.1.0" appwrite_auth_kit: dependency: "direct main" description: @@ -21,7 +21,7 @@ packages: name: async url: "https://pub.dartlang.org" source: hosted - version: "2.8.2" + version: "2.9.0" boolean_selector: dependency: transitive description: @@ -35,7 +35,7 @@ packages: name: characters url: "https://pub.dartlang.org" source: hosted - version: "1.2.0" + version: "1.2.1" charcode: dependency: transitive description: @@ -49,7 +49,7 @@ packages: name: clock url: "https://pub.dartlang.org" source: hosted - version: "1.1.0" + version: "1.1.1" collection: dependency: transitive description: @@ -119,7 +119,7 @@ packages: name: fake_async url: "https://pub.dartlang.org" source: hosted - version: "1.3.0" + version: "1.3.1" ffi: dependency: transitive description: @@ -150,21 +150,21 @@ packages: name: flutter_web_auth_2 url: "https://pub.dartlang.org" source: hosted - version: "1.0.1" + version: "1.1.2" flutter_web_auth_2_platform_interface: dependency: transitive description: name: flutter_web_auth_2_platform_interface url: "https://pub.dartlang.org" source: hosted - version: "1.1.0" + version: "1.1.2" flutter_web_auth_2_windows: dependency: transitive description: name: flutter_web_auth_2_windows url: "https://pub.dartlang.org" source: hosted - version: "1.0.1" + version: "1.1.2" flutter_web_plugins: dependency: transitive description: flutter @@ -197,21 +197,21 @@ packages: name: matcher url: "https://pub.dartlang.org" source: hosted - version: "0.12.11" + version: "0.12.12" material_color_utilities: dependency: transitive description: name: material_color_utilities url: "https://pub.dartlang.org" source: hosted - version: "0.1.4" + version: "0.1.5" meta: dependency: transitive description: name: meta url: "https://pub.dartlang.org" source: hosted - version: "1.7.0" + version: "1.8.0" package_info_plus: dependency: transitive description: @@ -260,7 +260,7 @@ packages: name: path url: "https://pub.dartlang.org" source: hosted - version: "1.8.1" + version: "1.8.2" path_provider: dependency: transitive description: @@ -342,7 +342,7 @@ packages: name: source_span url: "https://pub.dartlang.org" source: hosted - version: "1.8.2" + version: "1.9.0" stack_trace: dependency: transitive description: @@ -363,21 +363,21 @@ packages: name: string_scanner url: "https://pub.dartlang.org" source: hosted - version: "1.1.0" + version: "1.1.1" term_glyph: dependency: transitive description: name: term_glyph url: "https://pub.dartlang.org" source: hosted - version: "1.2.0" + version: "1.2.1" test_api: dependency: transitive description: name: test_api url: "https://pub.dartlang.org" source: hosted - version: "0.4.9" + version: "0.4.12" typed_data: dependency: transitive description: diff --git a/lib/src/accounts_provider.dart b/lib/src/accounts_provider.dart index e9e364c..da8fab9 100644 --- a/lib/src/accounts_provider.dart +++ b/lib/src/accounts_provider.dart @@ -1,5 +1,5 @@ import 'package:appwrite/appwrite.dart'; -import 'package:appwrite/models.dart'; +import 'package:appwrite/models.dart' as model; import 'package:flutter/widgets.dart'; extension AppwriteAuthKitExt on BuildContext { @@ -41,7 +41,8 @@ class AuthNotifier extends ChangeNotifier { late final Account _account; final Client _client; AuthStatus _status = AuthStatus.uninitialized; - User? _user; + + model.Account? _user; String? _error; late bool _loading; @@ -56,7 +57,7 @@ class AuthNotifier extends ChangeNotifier { Client get client => _client; String? get error => _error; bool get isLoading => _loading; - User? get user => _user; + model.Account? get user => _user; AuthStatus get status => _status; Future _getUser({bool notify = true}) async { @@ -130,7 +131,7 @@ class AuthNotifier extends ChangeNotifier { _status = AuthStatus.authenticating; notifyListeners(); try { - await _account.createPhoneSession(userId: userId, number: number); + await _account.createPhoneSession(userId: userId, phone: number); return true; } on AppwriteException catch (e) { _error = e.message; @@ -210,7 +211,7 @@ class AuthNotifier extends ChangeNotifier { } } - Future createJWT() async { + Future createJWT() async { try { return await _account.createJWT(); } on AppwriteException catch (e) { @@ -222,7 +223,7 @@ class AuthNotifier extends ChangeNotifier { /// Create account /// - Future create({ + Future create({ required String email, required String password, String userId = 'unique()', @@ -265,7 +266,8 @@ class AuthNotifier extends ChangeNotifier { } } - Future updatePrefs({required Map prefs}) async { + Future updatePrefs( + {required Map prefs}) async { try { _user = await _account.updatePrefs(prefs: prefs); notifyListeners(); @@ -277,9 +279,12 @@ class AuthNotifier extends ChangeNotifier { } } - Future getLogs({int? limit, int? offset}) async { + Future getLogs({int? limit, int? offset}) async { try { - return await _account.getLogs(limit: limit, offset: offset); + return await _account.listLogs(queries: [ + if (limit != null) Query.limit(limit), + if (offset != null) Query.offset(offset), + ]); } on AppwriteException catch (e) { _error = e.message; notifyListeners(); @@ -291,7 +296,7 @@ class AuthNotifier extends ChangeNotifier { required String provider, String? success, String? failure, - List? scopes, + List? scopes, }) async { try { await _account.createOAuth2Session( @@ -309,7 +314,7 @@ class AuthNotifier extends ChangeNotifier { } } - Future getSession({required String sessionId}) async { + Future getSession({required String sessionId}) async { try { return await _account.getSession(sessionId: sessionId); } on AppwriteException catch (e) { @@ -319,9 +324,9 @@ class AuthNotifier extends ChangeNotifier { } } - Future getSessions() async { + Future getSessions() async { try { - return await _account.getSessions(); + return await _account.listSessions(); } on AppwriteException catch (e) { _error = e.message; notifyListeners(); @@ -329,7 +334,7 @@ class AuthNotifier extends ChangeNotifier { } } - Future updateName({required String name}) async { + Future updateName({required String name}) async { try { _user = await _account.updateName(name: name); notifyListeners(); @@ -341,12 +346,12 @@ class AuthNotifier extends ChangeNotifier { } } - Future updatePhone({ + Future updatePhone({ required String number, required String password, }) async { try { - _user = await _account.updatePhone(number: number, password: password); + _user = await _account.updatePhone(phone: number, password: password); notifyListeners(); return _user; } on AppwriteException catch (e) { @@ -356,7 +361,7 @@ class AuthNotifier extends ChangeNotifier { } } - Future updateEmail({ + Future updateEmail({ required String email, required String password, }) async { @@ -371,7 +376,7 @@ class AuthNotifier extends ChangeNotifier { } } - Future updatePassword({ + Future updatePassword({ required String password, String? oldPassword, }) async { @@ -388,7 +393,7 @@ class AuthNotifier extends ChangeNotifier { } //createRecovery - Future createRecovery({ + Future createRecovery({ required String email, required String url, }) async { @@ -402,7 +407,7 @@ class AuthNotifier extends ChangeNotifier { } //updateRecovery - Future updateRecovery({ + Future updateRecovery({ required String userId, required String password, required String passwordAgain, @@ -422,7 +427,7 @@ class AuthNotifier extends ChangeNotifier { } //createVerification - Future createVerification({required String url}) async { + Future createVerification({required String url}) async { try { return await _account.createVerification(url: url); } on AppwriteException catch (e) { @@ -433,7 +438,7 @@ class AuthNotifier extends ChangeNotifier { } //updateVerification - Future updateVerification({ + Future updateVerification({ required String userId, required String secret, }) async { diff --git a/pubspec.lock b/pubspec.lock index 9414508..78c7954 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -7,14 +7,14 @@ packages: name: appwrite url: "https://pub.dartlang.org" source: hosted - version: "7.0.0" + version: "8.1.0" async: dependency: transitive description: name: async url: "https://pub.dartlang.org" source: hosted - version: "2.8.2" + version: "2.9.0" boolean_selector: dependency: transitive description: @@ -28,21 +28,14 @@ packages: name: characters url: "https://pub.dartlang.org" source: hosted - version: "1.2.0" - charcode: - dependency: transitive - description: - name: charcode - url: "https://pub.dartlang.org" - source: hosted - version: "1.3.1" + version: "1.2.1" clock: dependency: transitive description: name: clock url: "https://pub.dartlang.org" source: hosted - version: "1.1.0" + version: "1.1.1" collection: dependency: transitive description: @@ -70,7 +63,7 @@ packages: name: device_info_plus url: "https://pub.dartlang.org" source: hosted - version: "4.1.2" + version: "4.1.3" device_info_plus_linux: dependency: transitive description: @@ -105,14 +98,14 @@ packages: name: device_info_plus_windows url: "https://pub.dartlang.org" source: hosted - version: "4.0.0" + version: "4.1.0" fake_async: dependency: transitive description: name: fake_async url: "https://pub.dartlang.org" source: hosted - version: "1.3.0" + version: "1.3.1" ffi: dependency: transitive description: @@ -126,7 +119,7 @@ packages: name: file url: "https://pub.dartlang.org" source: hosted - version: "6.1.2" + version: "6.1.4" flutter: dependency: "direct main" description: flutter @@ -150,21 +143,21 @@ packages: name: flutter_web_auth_2 url: "https://pub.dartlang.org" source: hosted - version: "1.0.1" + version: "1.1.2" flutter_web_auth_2_platform_interface: dependency: transitive description: name: flutter_web_auth_2_platform_interface url: "https://pub.dartlang.org" source: hosted - version: "1.1.0" + version: "1.1.2" flutter_web_auth_2_windows: dependency: transitive description: name: flutter_web_auth_2_windows url: "https://pub.dartlang.org" source: hosted - version: "1.0.1" + version: "1.1.2" flutter_web_plugins: dependency: transitive description: flutter @@ -183,7 +176,7 @@ packages: name: http_parser url: "https://pub.dartlang.org" source: hosted - version: "4.0.1" + version: "4.0.2" js: dependency: transitive description: @@ -197,28 +190,28 @@ packages: name: lints url: "https://pub.dartlang.org" source: hosted - version: "2.0.0" + version: "2.0.1" matcher: dependency: transitive description: name: matcher url: "https://pub.dartlang.org" source: hosted - version: "0.12.11" + version: "0.12.12" material_color_utilities: dependency: transitive description: name: material_color_utilities url: "https://pub.dartlang.org" source: hosted - version: "0.1.4" + version: "0.1.5" meta: dependency: transitive description: name: meta url: "https://pub.dartlang.org" source: hosted - version: "1.7.0" + version: "1.8.0" package_info_plus: dependency: transitive description: @@ -253,21 +246,21 @@ packages: name: package_info_plus_web url: "https://pub.dartlang.org" source: hosted - version: "1.0.5" + version: "1.0.6" package_info_plus_windows: dependency: transitive description: name: package_info_plus_windows url: "https://pub.dartlang.org" source: hosted - version: "2.0.0" + version: "2.1.0" path: dependency: transitive description: name: path url: "https://pub.dartlang.org" source: hosted - version: "1.8.1" + version: "1.8.2" path_provider: dependency: transitive description: @@ -281,14 +274,14 @@ packages: name: path_provider_android url: "https://pub.dartlang.org" source: hosted - version: "2.0.16" + version: "2.0.20" path_provider_ios: dependency: transitive description: name: path_provider_ios url: "https://pub.dartlang.org" source: hosted - version: "2.0.10" + version: "2.0.11" path_provider_linux: dependency: transitive description: @@ -309,14 +302,14 @@ packages: name: path_provider_platform_interface url: "https://pub.dartlang.org" source: hosted - version: "2.0.4" + version: "2.0.5" path_provider_windows: dependency: transitive description: name: path_provider_windows url: "https://pub.dartlang.org" source: hosted - version: "2.1.2" + version: "2.1.3" platform: dependency: transitive description: @@ -330,7 +323,7 @@ packages: name: plugin_platform_interface url: "https://pub.dartlang.org" source: hosted - version: "2.1.2" + version: "2.1.3" process: dependency: transitive description: @@ -349,7 +342,7 @@ packages: name: source_span url: "https://pub.dartlang.org" source: hosted - version: "1.8.2" + version: "1.9.0" stack_trace: dependency: transitive description: @@ -370,21 +363,21 @@ packages: name: string_scanner url: "https://pub.dartlang.org" source: hosted - version: "1.1.0" + version: "1.1.1" term_glyph: dependency: transitive description: name: term_glyph url: "https://pub.dartlang.org" source: hosted - version: "1.2.0" + version: "1.2.1" test_api: dependency: transitive description: name: test_api url: "https://pub.dartlang.org" source: hosted - version: "0.4.9" + version: "0.4.12" typed_data: dependency: transitive description: @@ -398,14 +391,14 @@ packages: name: url_launcher url: "https://pub.dartlang.org" source: hosted - version: "6.1.5" + version: "6.1.6" url_launcher_android: dependency: transitive description: name: url_launcher_android url: "https://pub.dartlang.org" source: hosted - version: "6.0.17" + version: "6.0.19" url_launcher_ios: dependency: transitive description: @@ -433,7 +426,7 @@ packages: name: url_launcher_platform_interface url: "https://pub.dartlang.org" source: hosted - version: "2.1.0" + version: "2.1.1" url_launcher_web: dependency: transitive description: @@ -468,14 +461,14 @@ packages: name: win32 url: "https://pub.dartlang.org" source: hosted - version: "2.7.0" + version: "3.0.1" xdg_directories: dependency: transitive description: name: xdg_directories url: "https://pub.dartlang.org" source: hosted - version: "0.2.0+1" + version: "0.2.0+2" sdks: dart: ">=2.17.0 <3.0.0" flutter: ">=3.0.0" diff --git a/pubspec.yaml b/pubspec.yaml index 54a9131..66cd5f1 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -8,7 +8,7 @@ environment: flutter: ">=2.0.0" dependencies: - appwrite: ^7.0.0 + appwrite: ^8.1.0 flutter: sdk: flutter @@ -18,3 +18,4 @@ dev_dependencies: sdk: flutter flutter: null +