Files
zarzet f05bec0440 fix(desktop): do not crash while the window moves between screens
FlutterView.display throws a null check error when the engine has replaced
its display list and the view does not yet name one of the new displays,
which happens while a window is dragged on Windows. Every read of the
display now goes through displayOf, which gives null in that case.

Fixes #930
2026-11-18 21:48:21 +07:00

13 lines
281 B
Dart

import 'dart:ui';
/// The display [view] is on, or null. [FlutterView.display] throws while a
/// desktop window moves between screens.
Display? displayOf(FlutterView? view) {
if (view == null) return null;
try {
return view.display;
} on Error {
return null;
}
}