flutter_dialogflow 0.1.3

  • Readme
  • Changelog
  • Example
  • Installing
  • 90

Dialogflow v1 & v2 for Flutter apps.

Dialogflow

❤️ Star ❤️ the repo to support the project. Thanks!

A new Flutter package.

Awesome Tutorials #

Thanks for the tutorials!

Installation #

  • Add this to your package's pubspec.yaml file:
dependencies:
  flutter_dialogflow: ^0.1.0
  • You can install packages from the command line: with Flutter:
$ flutter packages get
  • Dialogflow v1 Import it Now in your Dart code, you can use:
 import 'package:flutter_dialogflow/flutter_dialogflow.dart';
  • Or Dialogflow v2 Import it Now in your Dart code, you can use:
 import 'package:flutter_dialogflow/dialogflow_v2.dart';

Usage #

Dialogflow v1 #

  • Dialogflow register and create new Agent
  • Copy Api key (Token)
  • Code
  Dialogflow dialogflow = Dialogflow(token: "Your Token");
  AIResponse response = await dialogflow.sendQuery("Your Query");
  • Example
  void Response(query) async {
    Dialogflow dialogflow = Dialogflow(token: "10178f9cb6cf12321asdf4aae75c87cd");
    AIResponse response = await dialogflow.sendQuery(query);
    print(response.getMessageResponse());
  }

Dialogflow v2 #

  • Dialogflow](https://dialogflow.com/) register and create new Agent
  • Project Setup and Authentication
    • First of all, we need to create a Google Cloud Platform Project using Console Google Cloud
    • Create or select an existing GCP project.
    • From the GCP console, go to APIs and Services and click on credentials.
    • Click on Create credentials and choose Service account key.
    • Select your service account from the dropdown, choose JSON and click Create. This will download the JSON key to your computer. Save it securely.
    • We downloaded a JSON file with all our data.
  • In your project create folder assets(folder name recommended optional)
  • Move file json in your project in folder created
  • open file pubspec.yaml
flutter:
  uses-material-design: true
  assets:
    - assets/your_file_downloaded_google_cloud.json
  • Import dialogflow_v2
import 'package:flutter_dialogflow/dialogflow_v2.dart';
  • Code
  AuthGoogle authGoogle = await AuthGoogle(fileJson: "Asset Your File Json").build();
  // Select Language.ENGLISH or Language.SPANISH or others...
  Dialogflow dialogflow =Dialogflow(authGoogle: authGoogle,language: Language.ENGLISH); 
  AIResponse response = await dialogflow.detectIntent("Your Query");
  • Example
  AuthGoogle authGoogle = await AuthGoogle(fileJson: "assets/your_file_downloaded_google_cloud.json").build();
  Dialogflow dialogflow = Dialogflow(authGoogle: authGoogle,language: Language.ENGLISH);
  AIResponse response = await dialogflow.detectIntent("Hi!!!");
  print(response.getMessage())
  • Or Get List Message type Card
Call function response.getListMessage() 
response List<dynamic>
example 
new CardDialogflow(response.getListMessage()[0]).title
Convert first item in CardDialogflow for worked easy
CardDialogflow have
- title
- subtitle
- imageUri
- List buttonss
    - each button have text and postback

Demo

Dialogflow For Flutter Web #

Visit the repository: Flutter Dialogflow Web 🚀

[0.1.3] - TODO: 27-03-2019.

  • Upgrade dependencies and added example

[0.1.2] - TODO: 27-03-2019.

  • Fix delete dartdoc

[0.1.1] - TODO: 26-11-2018.

  • Fix 'AUTHORIZATION' is deprecated and added dartdoc

[0.1.0] - TODO: 25-11-2018.

  • Support Dart 2.0 and added Support for Dialogflow V2

[0.0.1] - TODO: 27-05-2018.

  • The flutter_dialogflow makes it easy to integrate dialogflow

example/README.md

example #

A new Flutter project.

Getting Started #

For help getting started with Flutter, view our online documentation.

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  flutter_dialogflow: ^0.1.3

2. Install it

You can install packages from the command line:

with Flutter:


$ flutter pub get

Alternatively, your editor might support flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:flutter_dialogflow/flutter_dialogflow.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
90
Health:
Code health derived from static analysis. [more]
83
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
100
Overall:
Weighted score of the above. [more]
90
Learn more about scoring.

We analyzed this package on Dec 11, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.7.0
  • pana: 0.13.1+4
  • Flutter: 1.12.13+hotfix.4

Health issues and suggestions

Document public APIs. (-1 points)

294 out of 294 API elements have no dartdoc comment.Providing good documentation for libraries, classes, functions, and other API elements improves code readability and helps developers find and use your API.

Fix lib/utils/language.dart. (-13.96 points)

Analysis of lib/utils/language.dart reported 30 hints, including:

line 5 col 17: Name non-constant identifiers using lowerCamelCase.

line 10 col 17: Name non-constant identifiers using lowerCamelCase.

line 15 col 17: Name non-constant identifiers using lowerCamelCase.

line 20 col 17: Name non-constant identifiers using lowerCamelCase.

line 25 col 17: Name non-constant identifiers using lowerCamelCase.

Fix lib/v2/auth_google.dart. (-1.49 points)

Analysis of lib/v2/auth_google.dart reported 3 hints:

line 20 col 3: The class 'Future' wasn't exported from 'dart:core' until version 2.1, but this code is required to be able to run on earlier versions.

line 25 col 3: The class 'Future' wasn't exported from 'dart:core' until version 2.1, but this code is required to be able to run on earlier versions.

line 50 col 3: The class 'Future' wasn't exported from 'dart:core' until version 2.1, but this code is required to be able to run on earlier versions.

Fix lib/v2/dialogflow_v2.dart. (-0.50 points)

Analysis of lib/v2/dialogflow_v2.dart reported 1 hint:

line 117 col 3: The class 'Future' wasn't exported from 'dart:core' until version 2.1, but this code is required to be able to run on earlier versions.

Fix additional 3 files with analysis or formatting issues.

Additional issues in the following files:

  • lib/dialogflow_v2.dart (Run flutter format to format lib/dialogflow_v2.dart.)
  • lib/flutter_dialogflow.dart (Run flutter format to format lib/flutter_dialogflow.dart.)
  • lib/v2/message.dart (Run flutter format to format lib/v2/message.dart.)

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=1.20.1 <3.0.0
flutter 0.0.0
googleapis_auth ^0.2.6 0.2.11
http ^0.12.0+2 0.12.0+2
Transitive dependencies
async 2.4.0
charcode 1.1.2
collection 1.14.11 1.14.12
convert 2.1.1
crypto 2.1.4
http_parser 3.1.3
meta 1.1.8
path 1.6.4
pedantic 1.9.0
sky_engine 0.0.99
source_span 1.5.5
string_scanner 1.0.5
term_glyph 1.1.0
typed_data 1.1.6
vector_math 2.0.8
Dev dependencies
flutter_test
test any