onChange property

A stream of SystemAccentColor that notifies when the system accent color changes.

Currently only available on Windows.

Basica usage:

SystemTheme.onChange.listen((color) {
  debugPrint('Accent color changed to ${color.accent}');
});

Implementation

static Stream<SystemAccentColor> get onChange {
  if (kIsWeb || !Platform.isWindows) return Stream.value(accentColor);

  return _eventChannel.receiveBroadcastStream().map((event) {
    return SystemAccentColor._fromMap(event);
  }).distinct();
}