DialogFlowtter constructor

DialogFlowtter({
  1. String? projectId,
  2. String sessionId = _kDefaultSessionId,
  3. required DialogAuthCredentials credentials,
})

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";

Implementation

DialogFlowtter({
  this.projectId,
  this.sessionId = _kDefaultSessionId,
  required this.credentials,
}) {
  EquatableConfig.stringify = true;
}