Before starting, please make sure you have the followings:
• Flutter SDK installed in your system. • Google Account.
Go to dialogflow.com 2 and then click on “Go to Console” option at the top right corner, you’ll be asked to login from your Google Account, after your login is successful you’ll be asked to select you country, select it as well as Terms of Service and then click Accept.
After that, click on Create Agent, then provide the details like Agent Name, Default Time Zone and then click on Create. Till now you have successfully created your agent, now you can provide your own intents or import the dataset(TravelBot.zip) we’ve provided.
For Importing the dataset, click on the gear icon right next to your agent name, then select the Export & Import option. Import the file (TravelBot.zip). Now you have successfully imported the dataset.
Now you have to generate a credential JSON file, for that go to Google Cloud Console, here you have to select your project and then you have to click on APIs & Services, in that option select Credentials, it will redirect you to a page to create credential file, Click on Create Credentials it will show a dropdown menu in that select Service Account Key, then select Service Account to “Dialogflow Integrations” and Key Type to JSON. Then click on Create, now it will download your credential file. Please note that your simplicity rename that downloaded file to “credential”, it will help you setting up the flutter project.
After all this, now its time to put that file in our Flutter Project for creating a connection between our Application and the Dialogflow. For that open the Flutter Source Code in VS Code and then paste that “credential.json” file into the “assets” folder, now you have to provide a path of this file in pubspec.yaml file which you’ll find in the Source Code folder add this line “- assets/credentials.json” right below the asset option and then save.
You have successfully added Dialogflow into your app. Now its time to create .apk file for you to test your app in a real mobile device.
Generating an “.apk” file:
for generating an .apk file all you need to run a command in the terminal present in your VS Code. Please make sure you are in your project directory before running this command:
flutter build apk
Install this apk in your Android device. Thats it.
Leave A Comment