getActiveWindow method

  1. @override
Future<ActiveWindowInfo?> getActiveWindow()
override

Implementation

@override
Future<ActiveWindowInfo?> getActiveWindow() async {
  final rawResult = await methodChannel.invokeMethod('getActiveWindowInfo');
  ActiveWindowInfo? info;
  if (Platform.isWindows) {
    info = fromWindows(rawResult);
  } else {
    info = fromString(rawResult as String?);
  }
  if (info == null || info.title.isEmpty == true) {
    return null;
  } else {
    info.hostName = Platform.localHostname;
    return info;
  }
}