emulatorPath property

String? get emulatorPath

The SDK's emulator binary, found next to adb or under ANDROID_HOME, ANDROID_SDK_ROOT or the default SDK folder.

Implementation

String? get emulatorPath {
  final adb = File(adbPath);
  final roots = [
    if (adb.isAbsolute) adb.parent.parent.path,
    _env['ANDROID_HOME'],
    _env['ANDROID_SDK_ROOT'],
    '${_env['HOME']}/Library/Android/sdk',
    '${_env['HOME']}/Android/Sdk',
  ];
  for (final root in roots.whereType<String>()) {
    final exe = File('$root/emulator/emulator');
    if (exe.existsSync()) return exe.path;
  }
  return null;
}