Flutter dialogflow not accepting space in query
342
The best solution is to use API V2, it doesn't have this problem. Use this tutorial for set up.
You have to do it anyway, since API V1 will be shut down on October 23, 2019
Author by
BLB
Mobile app development enthusiast and Flutter evangelist. Engineer by choice.
Updated on December 14, 2022Comments
-
BLB over 1 year
Flutter dialogflow not accepting space in query. The query given to dialogflow client not accepting space. For example "Hi" is allowed but "Hi " is not allowed because it has space. Similarly it is accepting only one word and not sentence(since it has words with spaces). Need help.
import 'package:flutter_dialogflow/flutter_dialogflow.dart'; void Response(query) async { _textController.clear(); print("BLB calling $query= ${query.toString().trim()}"); Dialogflow dialogflow =Dialogflow(token: "**api_key**"); AIResponse response = await dialogflow.sendQuery(query).catchError((error){print("BLB $error ");}); print("BLB called ${response.getStatus.getCode}"); ChatMessage message = new ChatMessage( text: response.getMessageResponse(), name: "Eva the Bot", type: false, ); //Tts.speak(response.getMessageResponse()); setState(() { _messages.insert(0, message); }); }
Error message:
FormatException: Context name should contain only Latin letters (a-z A-Z), digits (0-9), underscore (_), and hyphen (-). Code: 400
Dialog flow working perfect in console (right side 'Try it now').:(