flutter_dialogflow_v2 0.3.1

Dialogflow v2 apis for flutter applications. #

Forked from https://github.com/VictorRancesCode/flutter_dialogflow

Dialogflow

Installation #

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

Usage #

  • Dialogflow 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_v2/flutter_dialogflow_v2.dart';
  • Code examples
AuthGoogle authGoogle = await AuthGoogle(fileJson: 'assets/your_file.json').build();
Dialogflow dialogflow = Dialogflow(authGoogle: authGoogle, sessionId: '123456');
DetectIntentResponse response = await dialogflow.detectIntent(
  DetectIntentRequest(
    queryInput: QueryInput(
      text: TextInput(
        text: 'Hello from flutter!',
        languageCode: Language.english,
      ),
    ),
    queryParams: QueryParameters(
      resetContexts: true,
    ),
  ),
);
  • or if you simply want to simple query some text:
AuthGoogle authGoogle = await AuthGoogle(fileJson: 'assets/your_file.json').build();
Dialogflow dialogflow = Dialogflow(authGoogle: authGoogle, sessionId: '123456');
DetectIntentResponse response = await dialogflow.detectIntentFromText('Hello!');
  • get text response
response.queryResult.queryText;
  • or list of messages
response.queryResult.fulfillmentMessages;

[0.3.1] Fix mapping

  • Fix some mappings

[0.3.0] Change doubles to nums

  • Fix map when dialogflow returns int instead of double

[0.2.0] Detect intent response refactoring

  • Add classes for mapping detect intent response
  • Code clean

[0.1.0] First release

  • Add support for detect intent parameters

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_v2: ^0.3.1

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_v2/flutter_dialogflow_v2.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
70
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
80
Overall:
Weighted score of the above. [more]
81
Learn more about scoring.

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

  • Dart: 2.4.0
  • pana: 0.12.19
  • Flutter: 1.7.8+hotfix.4

Platforms

Detected platforms: Flutter

References Flutter, and has no conflicting libraries.

Maintenance issues and suggestions

Support latest dependencies. (-20 points)

The version constraint in pubspec.yaml does not support the latest published versions for 2 dependencies (http, meta).

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.1.0 <3.0.0
flutter 0.0.0
googleapis_auth ^0.2.6 0.2.10
http ^0.11.3+16 0.11.3+17 0.12.0+2
meta ^1.1.6 1.1.6 1.1.7
Transitive dependencies
async 2.3.0
charcode 1.1.2
collection 1.14.11 1.14.12
convert 2.1.1
crypto 2.1.2
http_parser 3.1.3
path 1.6.4
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