From fb4b7da5d65f09cebe2a4c2ea28d484022bdd340 Mon Sep 17 00:00:00 2001 From: something411 <54055822+something411@users.noreply.github.com> Date: Wed, 16 Jun 2021 11:14:07 +0530 Subject: [PATCH] updated deprecated code --- lib/main.dart | 27 +++++++----- pubspec.lock | 113 +++++++++++++++++++++++++++----------------------- pubspec.yaml | 7 ++-- 3 files changed, 79 insertions(+), 68 deletions(-) diff --git a/lib/main.dart b/lib/main.dart index d2a8a74..4b5bd9d 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -31,7 +31,7 @@ class _MyHomePageState extends State { TextEditingController _phoneNumberController = TextEditingController(); TextEditingController _otpController = TextEditingController(); - FirebaseUser _firebaseUser; + User _firebaseUser; String _status; AuthCredential _phoneAuthCredential; @@ -52,7 +52,7 @@ class _MyHomePageState extends State { } Future _getFirebaseUser() async { - this._firebaseUser = await FirebaseAuth.instance.currentUser(); + this._firebaseUser = await FirebaseAuth.instance.currentUser; setState(() { _status = (_firebaseUser == null) ? 'Not Logged In\n' : 'Already LoggedIn\n'; @@ -79,7 +79,7 @@ class _MyHomePageState extends State { try { await FirebaseAuth.instance .signInWithCredential(this._phoneAuthCredential) - .then((AuthResult authRes) { + .then((authRes) { _firebaseUser = authRes.user; print(_firebaseUser.toString()); }).catchError((e) => _handleError(e)); @@ -121,7 +121,7 @@ class _MyHomePageState extends State { print(phoneAuthCredential); } - void verificationFailed(AuthException error) { + void verificationFailed(error) { print('verificationFailed'); _handleError(error); } @@ -174,7 +174,7 @@ class _MyHomePageState extends State { /// when used different phoneNumber other than the current (running) device /// we need to use OTP to get `phoneAuthCredential` which is inturn used to signIn/login - this._phoneAuthCredential = PhoneAuthProvider.getCredential( + this._phoneAuthCredential = PhoneAuthProvider.credential( verificationId: this._verificationId, smsCode: smsCode); _login(); @@ -261,22 +261,27 @@ class _MyHomePageState extends State { SizedBox(height: 48), Text('$_status'), SizedBox(height: 48), - MaterialButton( + ElevatedButton( onPressed: _login, child: Text('Login'), - color: Theme.of(context).accentColor, + style: ElevatedButton.styleFrom( + primary: Theme.of(context).accentColor, + ), ), SizedBox(height: 24), - MaterialButton( + ElevatedButton( onPressed: _logout, child: Text('Logout'), - color: Theme.of(context).accentColor, + style: ElevatedButton.styleFrom( + primary: Theme.of(context).accentColor), ), SizedBox(height: 24), - MaterialButton( + ElevatedButton( onPressed: _displayUser, child: Text('FirebaseUser'), - color: Theme.of(context).accentColor, + style: ElevatedButton.styleFrom( + primary: Theme.of(context).accentColor, + ), ) ], ), diff --git a/pubspec.lock b/pubspec.lock index 236b4fe..cc7b4bb 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -7,49 +7,63 @@ packages: name: async url: "https://pub.dartlang.org" source: hosted - version: "2.5.0-nullsafety.1" + version: "2.6.1" boolean_selector: dependency: transitive description: name: boolean_selector url: "https://pub.dartlang.org" source: hosted - version: "2.1.0-nullsafety.1" + version: "2.1.0" characters: dependency: transitive description: name: characters url: "https://pub.dartlang.org" source: hosted - version: "1.1.0-nullsafety.3" + version: "1.1.0" charcode: dependency: transitive description: name: charcode url: "https://pub.dartlang.org" source: hosted - version: "1.2.0-nullsafety.1" + version: "1.2.0" clock: dependency: transitive description: name: clock url: "https://pub.dartlang.org" source: hosted - version: "1.1.0-nullsafety.1" + version: "1.1.0" cloud_firestore: dependency: "direct main" description: name: cloud_firestore url: "https://pub.dartlang.org" source: hosted - version: "0.12.11" + version: "2.2.2" + cloud_firestore_platform_interface: + dependency: transitive + description: + name: cloud_firestore_platform_interface + url: "https://pub.dartlang.org" + source: hosted + version: "5.1.2" + cloud_firestore_web: + dependency: transitive + description: + name: cloud_firestore_web + url: "https://pub.dartlang.org" + source: hosted + version: "2.1.2" collection: dependency: transitive description: name: collection url: "https://pub.dartlang.org" source: hosted - version: "1.15.0-nullsafety.3" + version: "1.15.0" cupertino_icons: dependency: "direct main" description: @@ -63,42 +77,49 @@ packages: name: fake_async url: "https://pub.dartlang.org" source: hosted - version: "1.2.0-nullsafety.1" - firebase: + version: "1.2.0" + firebase_auth: + dependency: "direct main" + description: + name: firebase_auth + url: "https://pub.dartlang.org" + source: hosted + version: "1.4.1" + firebase_auth_platform_interface: dependency: transitive description: - name: firebase + name: firebase_auth_platform_interface url: "https://pub.dartlang.org" source: hosted - version: "7.2.1" - firebase_auth: - dependency: "direct main" + version: "4.3.1" + firebase_auth_web: + dependency: transitive description: - name: firebase_auth + name: firebase_auth_web url: "https://pub.dartlang.org" source: hosted - version: "0.14.0+9" + version: "1.3.1" firebase_core: dependency: "direct main" description: name: firebase_core url: "https://pub.dartlang.org" source: hosted - version: "0.4.4+3" + version: "1.3.0" firebase_core_platform_interface: dependency: transitive description: name: firebase_core_platform_interface url: "https://pub.dartlang.org" source: hosted - version: "1.0.4" + version: "4.0.1" firebase_core_web: dependency: transitive description: name: firebase_core_web url: "https://pub.dartlang.org" source: hosted - version: "0.1.1+2" + version: "1.1.0" flutter: dependency: "direct main" description: flutter @@ -114,69 +135,55 @@ packages: description: flutter source: sdk version: "0.0.0" - http: + http_parser: dependency: transitive description: - name: http + name: http_parser url: "https://pub.dartlang.org" source: hosted - version: "0.12.0+4" - http_parser: + version: "4.0.0" + intl: dependency: transitive description: - name: http_parser + name: intl url: "https://pub.dartlang.org" source: hosted - version: "3.1.4" + version: "0.17.0" js: dependency: transitive description: name: js url: "https://pub.dartlang.org" source: hosted - version: "0.6.1+1" + version: "0.6.3" matcher: dependency: transitive description: name: matcher url: "https://pub.dartlang.org" source: hosted - version: "0.12.10-nullsafety.1" + version: "0.12.10" meta: dependency: transitive description: name: meta url: "https://pub.dartlang.org" source: hosted - version: "1.3.0-nullsafety.3" + version: "1.3.0" path: dependency: transitive description: name: path url: "https://pub.dartlang.org" source: hosted - version: "1.8.0-nullsafety.1" - pedantic: - dependency: transitive - description: - name: pedantic - url: "https://pub.dartlang.org" - source: hosted - version: "1.9.0" + version: "1.8.0" plugin_platform_interface: dependency: transitive description: name: plugin_platform_interface url: "https://pub.dartlang.org" source: hosted - version: "1.0.2" - quiver: - dependency: transitive - description: - name: quiver - url: "https://pub.dartlang.org" - source: hosted - version: "2.0.5" + version: "2.0.0" sky_engine: dependency: transitive description: flutter @@ -188,56 +195,56 @@ packages: name: source_span url: "https://pub.dartlang.org" source: hosted - version: "1.8.0-nullsafety.2" + version: "1.8.1" stack_trace: dependency: transitive description: name: stack_trace url: "https://pub.dartlang.org" source: hosted - version: "1.10.0-nullsafety.1" + version: "1.10.0" stream_channel: dependency: transitive description: name: stream_channel url: "https://pub.dartlang.org" source: hosted - version: "2.1.0-nullsafety.1" + version: "2.1.0" string_scanner: dependency: transitive description: name: string_scanner url: "https://pub.dartlang.org" source: hosted - version: "1.1.0-nullsafety.1" + version: "1.1.0" term_glyph: dependency: transitive description: name: term_glyph url: "https://pub.dartlang.org" source: hosted - version: "1.2.0-nullsafety.1" + version: "1.2.0" test_api: dependency: transitive description: name: test_api url: "https://pub.dartlang.org" source: hosted - version: "0.2.19-nullsafety.2" + version: "0.3.0" typed_data: dependency: transitive description: name: typed_data url: "https://pub.dartlang.org" source: hosted - version: "1.3.0-nullsafety.3" + version: "1.3.0" vector_math: dependency: transitive description: name: vector_math url: "https://pub.dartlang.org" source: hosted - version: "2.1.0-nullsafety.3" + version: "2.1.0" sdks: - dart: ">=2.10.0-110 <2.11.0" - flutter: ">=1.12.13+hotfix.4 <2.0.0" + dart: ">=2.12.0 <3.0.0" + flutter: ">=1.12.13+hotfix.5" diff --git a/pubspec.yaml b/pubspec.yaml index 1f6cdbb..e1aff77 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -26,10 +26,9 @@ dependencies: cupertino_icons: ^0.1.3 # Add the dependency for the Firebase Core Flutter SDK - firebase_core: ^0.4.0+9 - - firebase_auth: ^0.14.0+5 - cloud_firestore: ^0.12.9+5 + firebase_core: ^1.3.0 + firebase_auth: ^1.4.1 + cloud_firestore: ^2.2.2 dev_dependencies: