DialogFlowtter class

Detect intent

One of the core features of DialogFlow is to detect what a person is trying to say. You can do that by detecting an intent that you have defined in your DialogFlow console

  1. Create an instance of DialogFlowtter and set the sessionId that will be used to identify the current conversation of the user with DialogFlow.

It's highly recommended that you use a different sessionId for every conversation that the user establishes with the Assistant

  final DialogFlowtter dialogFlowtter = DialogFlowtter(
    sessionId: "YOUR_SESSION_ID_HERE",
  );

(OPTIONAL) Change the JSON path to the one you're using. This defaults to assets/dialog_flow_auth.json.

    DialogFlowtter(
      jsonPath: "YOUR_JSON_PATH_HERE",
    );
  1. Create a QueryInput where you can specify what data you want to send to DialogFlow.
    final QueryInput queryInput = QueryInput(
      text: TextInput(
        text: "Hi. How are you?",
        languageCode: "en",
      ),
    );
  1. Send your input to DialogFlow through the detectIntent function.
    DetectIntentResponse response = await dialogFlowtter.detectIntent(
      queryInput: queryInput,
    );

You can check the code for more info on what info you can send and receive

Change the project id

You can change the Project ID that DialogFlowtter will use to find your intents in DialogFlow.

  1. Create an instance of DialogFlowtter
    final DialogFlowtter dialogFlowtter = DialogFlowtter();
  1. Change the projectId prop of the instance;
    dialogFlowtter.projectId = "deimos-apps-0905";

Constructors

DialogFlowtter()
Detect intent [...]
factory

Properties

client AutoRefreshingAuthClient
The authenticated client used by the package to make http requests
read-only
hashCode int
The hash code for this object. [...]
read-only, inherited
jsonPath String
The path of the json file downloaded from the DialogFlow console. [...]
final
projectId String
The associated projectId [...]
read / write
runtimeType Type
A representation of the runtime type of the object.
read-only, inherited
sessionId String
The session id that would be sent to the DialogFlow API [...]
final

Methods

detectIntent({QueryParameters queryParams, QueryInput queryInput, OutputAudioConfig audioConfig}) Future<DetectIntentResponse>
Processes a natural language query and returns structured, actionable data as a result. [...]
dispose() → void
Disposes the instance of DialogFlowtter and clears the authenticated client.
getJsonInfo(String _jsonPath) Future<Map<String, dynamic>>
Returns the JSON Auth info from the specified path
noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed. [...]
inherited
toString() String
Returns a string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator. [...]
inherited

Static Methods

getClient(Map<String, dynamic> json) Future<AutoRefreshingAuthClient>
Returns an authenticated HTTP client with the given credentials in the json obtained from jsonPath

Constants

kDefaultJsonPath → const String
The default JSON path used to find the auth info
'assets/dialog_flow_auth.json'
kDialogFlowApiVersion → const String
The DialogFlow API version that the package is currently using
"v2"
kDialogFlowUrl → const String
The DialogFlow URL that the package is currently using
"https://dialogflow.googleapis.com"