I want to exlude the lines includnig the character from the emulators list in the given…
- User
I want to exlude the lines includnig the character | from the emulators list in the given code. How can I do that?
// Copyright 2014 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file.
import 'dart:async';
import 'package:meta/meta.dart'; import 'package:process/process.dart';
import '../base/file_system.dart'; import '../base/io.dart'; import '../base/logger.dart'; import '../base/process.dart'; import '../convert.dart'; import '../device.dart'; import '../emulator.dart'; import 'android_sdk.dart'; import 'android_workflow.dart';
class AndroidEmulators extends EmulatorDiscovery { AndroidEmulators({ AndroidSdk? androidSdk, required AndroidWorkflow androidWorkflow, required FileSystem fileSystem, required Logger logger, required ProcessManager processManager, }) : _androidSdk = androidSdk, _androidWorkflow = androidWorkflow, _fileSystem = fileSystem, _logger = logger, _processManager = processManager, _processUtils = ProcessUtils(logger: logger, processManager: processManager);
final AndroidWorkflow _androidWorkflow; final AndroidSdk? _androidSdk; final FileSystem _fileSystem; final Logger _logger; final ProcessManager _processManager; final ProcessUtils _processUtils;
@override bool get supportsPlatform => true;
@override bool get canListAnything => _androidWorkflow.canListEmulators;
@override bool get canLaunchAnything => _androidWorkflow.canListEmulators && _androidSdk?.getAvdManagerPath() != null;
@override Future<List> get emulators => _getEmulatorAvds();
/// Return the list of available emulator AVDs. Future<List> _getEmulatorAvds() async { final String? emulatorPath = _androidSdk?.emulatorPath; if (emulatorPath == null) { return []; }
codefinal String listAvdsOutput = (await _processUtils.run( <String>[emulatorPath, '-list-avds'])).stdout.trim(); final List<AndroidEmulator> emulators = <AndroidEmulator>[]; _extractEmulatorAvdInfo(listAvdsOutput, emulators); return emulators;}
/// Parse the given
emulator -list-avdsoutput in [text], and fill out the given list /// of emulators by reading information from the relevant ini files. void _extractEmulatorAvdInfo(String text, List emulators) { for (final String id in text.trim().split('\n').where((String l) => l != '')) { emulators.add(_loadEmulatorInfo(id)); } }AndroidEmulator _loadEmulatorInfo(String id) { id = id.trim(); final String? avdPath = _androidSdk?.getAvdPath(); final AndroidEmulator androidEmulatorWithoutProperties = AndroidEmulator( id, processManager: _processManager, logger: _logger, androidSdk: _androidSdk, ); if (avdPath == null) { return androidEmulatorWithoutProperties; } final File iniFile = _fileSystem.file(_fileSystem.path.join(avdPath, '$id.ini')); if (!iniFile.existsSync()) { return androidEmulatorWithoutProperties; } final Map<String, String> ini = parseIniLines(iniFile.readAsLinesSync()); final String? path = ini['path']; if (path == null) { return androidEmulatorWithoutProperties; } final File configFile = _fileSystem.file(_fileSystem.path.join(path, 'config.ini')); if (!configFile.existsSync()) { return androidEmulatorWithoutProperties; } final Map<String, String> properties = parseIniLines(configFile.readAsLinesSync()); return AndroidEmulator( id, properties: properties, processManager: _processManager, logger: _logger, androidSdk: _androidSdk, ); } }
- Assistant