area static method
Captures the ScreenshotArea called name.
pixelRatio defaults to the device's, and locale and theme work as
they do for capture. Throws a StateError when no area with that
name is on screen.
Implementation
static Future<Screenshot> area(
String name, {
double? pixelRatio,
bool settle = true,
String? locale,
String? theme,
}) async {
if (locale != null || theme != null) {
return _inLook(
locale,
theme,
() => area(name, pixelRatio: pixelRatio, settle: false),
);
}
return _hidingPrivate(settle, () {
final RenderObject? boundary = _areas[name]?._boundaryKey.currentContext
?.findRenderObject();
if (boundary is! RenderRepaintBoundary || !boundary.attached) {
final List<String> names = areas;
throw StateError(
'There\'s no ScreenshotArea called "$name" on screen.'
'${names.isEmpty ? '' : ' On screen: ${names.join(', ')}.'}',
);
}
return _fromBoundary(boundary, pixelRatio);
});
}