findObjectWithName method
Find an object in this bot with a specific name and type.
{name} is the name of the object that you want to find.
{type} is the type of object that you want to find.
Implementation
Future<BotObject?> findObjectWithName({required String name, required String type}) async {
List<BotObject>? allObjects = await findObjects(type: type);
try {
GetIt.I<BotnoiClient>().finishedSuccessfully();
return allObjects!.firstWhere((element) => element.objectName == name);
} catch (e) {
GetIt.I<BotnoiClient>().finishedFailed();
return null;
}
}