VoiceCommand class

Represents a voice command with a pattern and associated action.

Constructors

VoiceCommand.new({required String pattern, required dynamic action(List<String> matches), String? description, int priority = 0})
Creates a new voice command.
const

Properties

action → dynamic Function(List<String> matches)
The action to execute when the command is recognized.
final
description String?
Optional description of what this command does.
final
hashCode int
The hash code for this object.
no setteroverride
pattern String
The regex pattern to match against recognized speech.
final
priority int
Optional priority for command matching (higher numbers = higher priority).
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

execute(List<String> matches) → void
Executes the command action with the given matches.
extractMatches(String text) List<String>?
Extracts matches from the given text using this command's pattern.
matches(String text) bool
Checks if the given text matches this command's pattern.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
override

Operators

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