-
Notifications
You must be signed in to change notification settings - Fork 74
Open
Description
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 query = "hi";
void _sendQuery() async {
try {
AuthGoogle authGoogle = await AuthGoogle(fileJson: "assets/dependencies/dialogflow.json").build();
Dialogflow dialogflow = Dialogflow(authGoogle: authGoogle,language: Language.ENGLISH);
print(dialogflow.toString());
AIResponse response = await dialogflow.detectIntent(query);
print(response.getMessage());
} catch(e) {
print('------------------------------${e.toString()}');
}
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text('Ask Now'),
),
body: RaisedButton(
onPressed: _sendQuery,
color: Colors.black87,
child: Text('Send Query', style: TextStyle(color: Colors.white)),
),
);
}
}
ERROR LOG -
I/flutter ( 9861): Instance of 'Dialogflow'
I/flutter ( 9861): ------------------------------NoSuchMethodError: The method '[]' was called on null.
I/flutter ( 9861): Receiver: null
I/flutter ( 9861): Tried calling: []("queryText")
I've taken all the necessary steps in my view. Is there anything missing out? in the code or in the process of GCP Json file downloading. I've not verified the OAuth screen though. And my GCP account is NOT payment verified.
darasat, daniele777, ChalermchaiPohek and mregandla
Metadata
Metadata
Assignees
Labels
No labels