扑扑的firebase认证

时间:2019-03-26 14:13:50

标签: flutter firebase-authentication

请我需要帮助,无法将Firebase与抖动连接。我有此问题,我有此消息:

  

Firebase:找不到Android应用程序模块。仅Android应用程序模块可以连接到Firebase在线项目。创建新的Android应用程序模块或创建/导入其他Android Studio项目。


    import 'package:flutter/material.dart';
    import 'package:firebase_auth/firebase_auth.dart';
    import 'homepage.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 homepage();
        }));
      } catch (e) {
        print(e.message);
      }
      ;
    }
  }
}

0 个答案:

没有答案