Я видел видео на Youtube, чтобы реализовать вход в систему Google, и ниже приведен код. приложение работает без ошибок, но когда я нажимаю на кнопку, отображается закусочная, но ничего не происходит. приложение связано с firebase и включен вход в Google
код:
import 'package:app/pages/home.dart';
import 'package:firebase_auth/firebase_auth.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:google_sign_in/google_sign_in.dart';
import 'package:firebase_core/firebase_core.dart';
class GoogleSignin extends StatefulWidget {
@override
_GoogleSigninState createState() => _GoogleSigninState();
}
class _GoogleSigninState extends State<GoogleSignin> {
final FirebaseAuth _firebaseAuth= FirebaseAuth.instance;
final GoogleSignIn _googleSignIn= new GoogleSignIn();
Future<FirebaseUser> _signIn(BuildContext context) async{
Scaffold.of(context).showSnackBar(new SnackBar(content: new Text('Sign in'),
));
final GoogleSignInAccount googleUser= await _googleSignIn.signIn();
final GoogleSignInAuthentication googleAuth= await googleUser.authentication;
final AuthCredential credential= GoogleAuthProvider.getCredential(idToken: googleAuth.idToken, accessToken: googleAuth.accessToken);
FirebaseUser userDetails= (await _firebaseAuth.signInWithCredential(credential)) as FirebaseUser;
ProviderDetails providerInfo= new ProviderDetails(userDetails.providerId);
List<ProviderDetails> providerData=new List<ProviderDetails>();
providerData.add(providerInfo);
UserDetails details=new UserDetails(userDetails.photoUrl, providerData, userDetails.providerId, userDetails.email, userDetails.displayName);
Navigator.push(context, new MaterialPageRoute(builder: (context)=> new HomePage()));
}
@override
Widget build(BuildContext context) {
return Scaffold(
body: Builder(
builder: (context) => Stack(
fit: StackFit.expand,
children: <Widget>[
Container(
width: MediaQuery.of(context).size.width,
height: MediaQuery.of(context).size.height,
child: Image.asset('',fit: BoxFit.fill,),
color: Color(0xFF080e44),
),
Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
SizedBox(height: 10.0),
Container(
width: 250.0,
child: Align(
alignment: Alignment.bottomCenter,
child: RaisedButton(
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(30.0)
),
color: Colors.white,
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Text('Signin with Google', style: TextStyle(color: Color(0xFF080e44),fontSize: 20.0, fontWeight: FontWeight.w900),)
],
),
onPressed: ()=> _signIn(context)
.then((FirebaseUser user) => print(user))
.catchError((e)=> print(e)),
),
),
),
Container(
width: 250.0,
child: Align(
alignment: Alignment.bottomCenter,
child: RaisedButton(
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(30.0)
),
color: Colors.white,
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Text('Signin with Email', style: TextStyle(color: Color(0xFF080e44),fontSize: 20.0, fontWeight: FontWeight.w900),)
],
),
onPressed: (){
},
),
),
),
Container(
width: 250.0,
child: Align(
alignment: Alignment.bottomCenter,
child: RaisedButton(
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(30.0)
),
color: Colors.white,
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Text('Signin with Apple', style: TextStyle(color: Color(0xFF080e44),fontSize: 20.0, fontWeight: FontWeight.w900),)
],
),
onPressed: (){
},
),
),
),
],
)
],
),
),
);
}
}
class UserDetails{
final String providerDetails;
final String userName;
final String photUrl;
final String userEmail;
final List<ProviderDetails> providerData;
UserDetails(
this.photUrl,
this.providerData,
this.providerDetails,
this.userEmail,
this.userName,
);
}
class ProviderDetails{
ProviderDetails(
this.providerDetails
);
final String providerDetails;
}
Вот Журнал запуска :
Performing hot restart...
Syncing files to device POCO F1...
Restarted application in 9,717ms.
I/flutter (22152): ══╡ EXCEPTION CAUGHT BY IMAGE RESOURCE SERVICE ╞════════════════════════════════════════════════════
I/flutter (22152): The following assertion was thrown resolving an image codec:
I/flutter (22152): Unable to load asset:
I/flutter (22152):
I/flutter (22152): When the exception was thrown, this was the stack:
I/flutter (22152): #0 PlatformAssetBundle.load (package:flutter/src/services/asset_bundle.dart:221:7)
I/flutter (22152): <asynchronous suspension>
I/flutter (22152): #1 AssetBundleImageProvider._loadAsync (package:flutter/src/painting/image_provider.dart:664:31)
I/flutter (22152): #2 AssetBundleImageProvider.load (package:flutter/src/painting/image_provider.dart:648:14)
I/flutter (22152): #3 ImageProvider.resolveStreamForKey.<anonymous closure> (package:flutter/src/painting/image_provider.dart:501:13)
I/flutter (22152): #4 ImageCache.putIfAbsent (package:flutter/src/painting/image_cache.dart:359:22)
I/flutter (22152): #5 ImageProvider.resolveStreamForKey (package:flutter/src/painting/image_provider.dart:499:80)
I/flutter (22152): #6 ScrollAwareImageProvider.resolveStreamForKey (package:flutter/src/widgets/scroll_aware_image_provider.dart:106:19)
I/flutter (22152): #7 ImageProvider.resolve.<anonymous closure> (package:flutter/src/painting/image_provider.dart:330:9)
I/flutter (22152): #8 ImageProvider._createErrorHandlerAndKey.<anonymous closure>.<anonymous closure> (package:flutter/src/painting/image_provider.dart:460:26)
I/flutter (22152): (elided 13 frames from dart:async)
I/flutter (22152):
I/flutter (22152): Image provider: AssetImage(bundle: null, name: "")
I/flutter (22152): Image key: AssetBundleImageKey(bundle: PlatformAssetBundle#80b2d(), name: "", scale: 1.0)
I/flutter (22152): ════════════════════════════════════════════════════════════════════════════════════════════════════
════════ Exception caught by image resource service ════════════════════════════════════════════════
The following assertion was thrown resolving an image codec:
Unable to load asset:
When the exception was thrown, this was the stack:
#0 PlatformAssetBundle.load (package:flutter/src/services/asset_bundle.dart:221:7)
<asynchronous suspension>
#1 AssetBundleImageProvider._loadAsync (package:flutter/src/painting/image_provider.dart:664:31)
#2 AssetBundleImageProvider.load (package:flutter/src/painting/image_provider.dart:648:14)
#3 ImageProvider.resolveStreamForKey.<anonymous closure> (package:flutter/src/painting/image_provider.dart:501:13)
...
Image provider: AssetImage(bundle: null, name: "")
Image key: AssetBundleImageKey(bundle: PlatformAssetBundle#80b2d(), name: "", scale: 1.0)
════════════════════════════════════════════════════════════════════════════════════════════════════
I/flutter (22152): MissingPluginException(No implementation found for method init on channel plugins.flutter.io/google_sign_in)
I/flutter (22152): MissingPluginException(No implementation found for method init on channel plugins.flutter.io/google_sign_in)
I/om.app.constel(22152): Waiting for a blocking GC ProfileSaver
I/flutter (22152): MissingPluginException(No implementation found for method init on channel plugins.flutter.io/google_sign_in)
W/om.app.constel(22152): Reducing the number of considered missed Gc histogram windows from 175 to 100
I/om.app.constel(22152): WaitForGcToComplete blocked ProfileSaver on ProfileSaver for 24.943ms
I/flutter (22152): MissingPluginException(No implementation found for method init on channel plugins.flutter.io/google_sign_in)
I/flutter (22152): MissingPluginException(No implementation found for method init on channel plugins.flutter.io/google_sign_in)
I/flutter (22152): MissingPluginException(No implementation found for method init on channel plugins.flutter.io/google_sign_in)
I/flutter (22152): MissingPluginException(No implementation found for method init on channel plugins.flutter.io/google_sign_in)
I/chatty (22152): uid=10413(com.app.constell) Thread-4 identical 4 lines
I/flutter (22152): MissingPluginException(No implementation found for method init on channel plugins.flutter.io/google_sign_in)
I/flutter (22152): MissingPluginException(No implementation found for method init on channel plugins.flutter.io/google_sign_in)
I/flutter (22152): MissingPluginException(No implementation found for method init on channel plugins.flutter.io/google_sign_in)
I/flutter (22152): MissingPluginException(No implementation found for method init on channel plugins.flutter.io/google_sign_in)
I/chatty (22152): uid=10413(com.app.constell) Thread-4 identical 3 lines
I/flutter (22152): MissingPluginException(No implementation found for method init on channel plugins.flutter.io/google_sign_in)
I/flutter (22152): MissingPluginException(No implementation found for method init on channel plugins.flutter.io/google_sign_in)
I/flutter (22152): MissingPluginException(No implementation found for method init on channel plugins.flutter.io/google_sign_in)
I/flutter (22152): MissingPluginException(No implementation found for method init on channel plugins.flutter.io/google_sign_in)
I/flutter (22152): MissingPluginException(No implementation found for method init on channel plugins.flutter.io/google_sign_in)
I/flutter (22152): MissingPluginException(No implementation found for method init on channel plugins.flutter.io/google_sign_in)
I/flutter (22152): MissingPluginException(No implementation found for method init on channel plugins.flutter.io/google_sign_in)
Есть идеи, что означает эта ошибка ??
I/flutter (22152): MissingPluginException(No implementation found for method init on channel plugins.flutter.io/google_s
................................ .................................................. ......................