announce method Null safety

Future<void> announce(
  1. String message,
  2. TextDirection textDirection,
  3. {Assertiveness assertiveness = Assertiveness.polite}
)

Sends a semantic announcement.

This should be used for announcement that are not seamlessly announced by the system as a result of a UI state change.

For example a camera application can use this method to make accessibility announcements regarding objects in the viewfinder.

The assertiveness level of the announcement is determined by assertiveness. Currently, this is only supported by the web engine and has no effect on other platforms. The default mode is Assertiveness.polite.

Implementation

static Future<void> announce(String message, TextDirection textDirection, {Assertiveness assertiveness = Assertiveness.polite}) async {
  final AnnounceSemanticsEvent event = AnnounceSemanticsEvent(message, textDirection, assertiveness: assertiveness);
  await SystemChannels.accessibility.send(event.toMap());
}