toggleSelection function
Toggles the Flutter inspector widget selection mode.
Never throws; all error conditions are represented as sealed result cases.
Implementation
Future<SelectResult> toggleSelection(SelectInput input) async {
try {
final isolateId = await findFlutterIsolateId();
if (isolateId == null) return const SelectNoIsolate();
await vmServiceCall(
'ext.flutter.inspector.show',
params: {'isolateId': isolateId, 'enabled': input.enabled.toString()},
);
return SelectSuccess(input.enabled);
} on AppDiedException catch (e) {
return SelectAppDied(logLines: e.logLines, reason: e.reason);
} catch (e) {
return SelectError(e.toString());
}
}