findLiveRecorder function

Future<LiveRecorder> findLiveRecorder(
  1. LiveApp app, {
  2. required String projectRoot,
  3. LiveProcesses processes = const LiveProcesses(),
})

Finds a recorder for the device app runs on.

The iOS Simulator is found by the UDID the app reports (protocol 10), or else by its name. An Android device is the one running the app's applicationId, or ANDROID_SERIAL. Throws a LiveCommandException when the device can't be recorded.

Implementation

Future<LiveRecorder> findLiveRecorder(
  LiveApp app, {
  required String projectRoot,
  LiveProcesses processes = const LiveProcesses(),
}) async {
  final Object? platform = app.status['platform'];
  switch (platform) {
    case 'ios':
      return _findSimulator(app, processes);
    case 'android':
      return _findAndroid(app, projectRoot, processes);
    default:
      throw LiveCommandException(
        'Metro can record playbooks on the iOS Simulator and Android, not on '
        '${platform ?? app.device} yet.',
      );
  }
}