talira

Device Preview

Switch a running Flutter app to any simulated device, with no rebuild or simulator

open sourceMITfree

Device Preview (the device_preview package) switches your running Flutter app to another device instantly, with no rebuild and no simulator: screen size, pixel ratio, safe areas, orientation, folds, the software keyboard, locale, brightness, text scale, accessibility settings and target platform all change, and the app reads them through the same MediaQuery it always uses. You control it from a Flutter DevTools extension, from Dart, or from tests, and it's active in debug and profile builds and off in release builds.

Problems it solves

  • check my Flutter app's layout on many phone and tablet sizes without simulators
  • catch overflow at large text sizes in my Flutter app before users do
  • test my Flutter UI in landscape, dark mode and other locales quickly

Features

  • simulate screen size, pixel ratio, safe areas, orientation and folds in the running app
  • change locale, brightness, text scale and accessibility settings live
  • device presets such as recent iPhones, set from Dart
  • a Flutter DevTools extension to pick devices
  • drive it from tests
  • off in release builds, so nothing ships to users

Limitations

  • DevicePreview.controller throws when simulation is off, as in every release build, so shipped code has to use maybeController.1