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(
    credentials: credentials,
    sessionId: "YOUR_SESSION_ID_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(
    credentials: credentials,
  );
  1. Change the projectId prop of the instance;
  dialogFlowtter.projectId = "deimos-apps-0905";

Constructors

DialogFlowtter({String? projectId, String sessionId = _kDefaultSessionId, required DialogAuthCredentials credentials})
Detect intent
DialogFlowtter.fromJson(Map<String, dynamic> json, {String? projectId, String sessionId = _kDefaultSessionId})
Creates a DialogFlowtter instance from the JSON given
factory

Properties

client → AutoRefreshingAuthClient?
The authenticated client used by the package to make http requests
no setter
credentials DialogAuthCredentials
The auth credentials needed by DialogFlowtter to authenticate the API http calls
final
hashCode int
The hash code for this object.
no setterinherited
projectId String?
The associated projectId
getter/setter pair
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
sessionId String
The session id that would be sent to the DialogFlow API
final

Methods

detectIntent({QueryParameters? queryParams, required 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.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

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

Static Methods

fromFile({String path = kDefaultJsonPath, String? projectId, String sessionId = _kDefaultSessionId}) Future<DialogFlowtter>
Creates a DialogFlowtter instance from the JSON in the given path
fromNetwork(String url, {String? projectId, String sessionId = _kDefaultSessionId}) Future<DialogFlowtter>
Creates a DialogFlowtter instance with the JSON obtained from the given url
getClient(DialogAuthCredentials credentials) Future<AutoRefreshingAuthClient>
Returns an authenticated HTTP client

Constants

kDefaultJsonPath → const String
The default JSON path used to find the auth info
kDialogFlowApiVersion → const String
The DialogFlow API version that the package is currently using
kDialogFlowUrl → const String
The DialogFlow URL that the package is currently using