virtual_device 0.0.5+1
virtual_device: ^0.0.5+1 copied to clipboard

Dart native
Flutter Android iOS Linux macOS Windows

Discover, run, stop, create, and destroy iOS simulators and Android emulators

Virtual Device #

Manage one or many iOS simulators and Android emulators

Setup #

This package expects several commands to be in the shell:

  • xcrun for iOS
  • adb, avdmanager, and emulator for Android

Command Line Tools installs xcrun, but Android requires updating the PATH:

# your ANDROID_HOME may vary; this is usually the install path on Mac machines
export ANDROID_HOME="$HOME/Library/Android/sdk"
export PATH="$PATH:$ANDROID_HOME/emulator:$ANDROID_HOME/tools/bin:$ANDROID_HOME/platform-tools:$ANDROID_HOME/tools"

Usage #

import 'package:virtual_device/virtual_device.dart';

final simulators = await IosSimulator.availableDevices();
await simulators.first.start();

// Virtual Device will increment your simulator names, so you don't need to
// specify them. This would become `iPad Air 2:14.2:1`, but if it were run
// again, the created device would be named `iPad Air 2:14.2:2`.
final newSimulator = IosSimulator(
  model: 'iPad Air 2',
  os: OperatingSystem.iOS,
  osVersion: '14.2',
);
await newSimulator.createOrStart();

// shutdown
await newSimulator.stop();

// clean
await newSimulator.wipe();

// start again
await newSimulator.start();
await newSimulator.stop();

// destroy
await newSimulator.delete();

Command Line #

Make the command globally available:

pub global activate virtual_device

And use it to create or run simulators:

virtual_device create -p ios -v 14.2 -m "iPad Air 2"
virtual_device start -p ios "iPad Air 2:14.2:1"

For a complete list of models and versions available on the machine, run virtual_device list models or virtual_device list versions.

0
likes
100
pub points
21%
popularity

Discover, run, stop, create, and destroy iOS simulators and Android emulators

Repository (GitHub)
View/report issues

Documentation

API reference

Uploader

tshedor@gmail.com

License

MIT (LICENSE)

Dependencies

args, meta, uuid

More

Packages that depend on virtual_device