小编Abb*_*bas的帖子

Flutter:Dialogflow SDK 返回尝试调用:[]("queryText") 错误

我正在尝试将该flutter_dialogflow包与 Dialogflow v2一起使用。在我看来,我已经采取了所有必要的步骤。我需要帮助才能知道我是否错过了什么。

我的代码 -

import 'package:flutter/material.dart';
import 'package:flutter_dialogflow/dialogflow_v2.dart';

class Home extends StatefulWidget {
  Home({Key key}) : super(key: key);

  @override
  _HomeState createState() => _HomeState();
}

class _HomeState extends State<Home> {

  String sampleQuery = "travel destinations in india";

  void _sendQuery() async {
    try {
    AuthGoogle _authGoogle = await AuthGoogle(fileJson: "assets/dependencies/dialogflow.json").build();
    Dialogflow dialogflow = Dialogflow(authGoogle: _authGoogle, language: Language.english);
    AIResponse response = await dialogflow.detectIntent("hi");
    print(response.getMessage());


    } catch(e) {
      print('------------------------------${e.toString()}');
    }

  }
  @override
  Widget build(BuildContext context) {
    return Scaffold(
       appBar: AppBar(
         title: …
Run Code Online (Sandbox Code Playgroud)

flutter dialogflow-es

6
推荐指数
1
解决办法
816
查看次数

Firebase.instance.signOut() 未将 currentUser() 设置为 null

为什么我的 signOut() 方法没有将 currentUser() 设置为 null?

当我单击主页上的注销时,它会检查 isAuthenticated() 方法,该方法返回用户而不是 null。另外,看看我在 logout() 方法中包含的两个注释。谢谢你!!

这是我的代码 -

class Auth with ChangeNotifier {
  final FirebaseAuth _auth = FirebaseAuth.instance;
  final GoogleSignIn _googleSignIn = GoogleSignIn();

  bool isAuthenticated() {
    print('$currentUser inside the isAuthenticated');
    if (currentUser == null) {
      print('false');
      return false;
    }
    print('true');
    return true;
  }

  Future<FirebaseUser> get currentUser async {
    return await _auth.currentUser();
  }


  Future<FirebaseUser> signInWithEmail(String email, String password) async {
    try {
      final response = await _auth.signInWithEmailAndPassword(
        email: email,
        password: password,
      );
      print(response);

      if (response …
Run Code Online (Sandbox Code Playgroud)

firebase firebase-authentication flutter

5
推荐指数
1
解决办法
377
查看次数