我有扑扑登录Firebase的问题

时间:2019-03-27 00:53:57

标签: firebase flutter firebase-authentication

您好,当我在flutter中使用密码和电子邮件创建登录时遇到了这个问题,我将我的应用程序与firebase相关联,当我在应用程序中输入电子邮件和密码时,我总是遇到这个问题 “ W / BiChannelGoogleApi(4941):[FirebaseAuth:] getGoogleApiForMethod()返回了Gms:com.google.firebase.auth.api.internal.zzal@d6ecdba “

import 'package:flutter/material.dart';
import 'package:firebase_auth/firebase_auth.dart';
import 'main.dart';
import 'home.dart';
class LoginPage extends StatefulWidget {
  @override
  _LoginPageState createState() => _LoginPageState();
}

class _LoginPageState extends State<LoginPage> {
  String _email;
  String _password;
  GlobalKey<FormState> _keyform = GlobalKey<FormState>();
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: new Text("flutter login"),
      ),
      body: new Form(
          key: _keyform,
          child: new Column(
            children: <Widget>[
              new TextFormField(
                validator: (input) {
                  if (input.isEmpty) {
                    return "saisir votre email";
                  }
                },
                onSaved: (input) => _email = input,
                decoration: InputDecoration(labelText: "email"),
              ),
              new TextFormField(
                validator: (input) {
                  if (input.length < 6) {
                    return "changer votre mot de passe";
                  }
                },
                onSaved: (input) => _password = input,
                obscureText: true,
                decoration: InputDecoration(labelText: "mot de passe"),
              ),
              RaisedButton(
                onPressed: signin,
                child: Text("envoyer"),
              )
            ],
          )),
    );
  }

  Future<void> signin() async {
    final formState = _keyform.currentState;
    if (formState.validate()) {
      formState.save();
      try {
        FirebaseUser user = await FirebaseAuth.instance
            .signInWithEmailAndPassword(email: _email, password: _password);
        Navigator.push(context,
            MaterialPageRoute(builder: (BuildContext context) {
              return new home();
            }));
      } catch (e) {
        print(e.message);
      }
      ;
    }
  }
}

0 个答案:

没有答案