readNativeSurface method
The native surface over the app as data, reusing shot when the reader works from screenshots; null when it cannot be read in surfaceReadTimeout or says nothing.
Implementation
Future<NativeSurface?> readNativeSurface({String? shot}) async {
final reader = nativeReader;
if (reader == null) return null;
try {
final scene = await (reader is OcrNativeReader && shot != null ? reader.readFrom(shot) : reader.readSnapshot())
.timeout(surfaceReadTimeout);
if (scene.root.glintId == '_native_surface') return null;
final surface = classifySurface(scene, owner: nativeSurfaceName);
return surface.hasContent || surface.owner != null ? surface : null;
} on Object {
return null;
}
}