findIntentWithName method

Future<BotIntent?> findIntentWithName(
  1. String name
)

Find an intent in this bot with a specific name.

  • {name} is the name of the intent that you want to find.

Implementation

Future<BotIntent?> findIntentWithName(String name) async {
  List<BotIntent>? allIntents = await findIntents();
  try {
    GetIt.I<BotnoiClient>().finishedSuccessfully();
    return allIntents!.firstWhere((element) => element.name == name);
  } catch (e) {
    GetIt.I<BotnoiClient>().finishedFailed();
    return null;
  }
}