How to determine if flutter is running in simulator

Using the device info plus plugin you can get various information about the device you're running on, including 'isPhysicalDevice' for both Android and iOS (although you'll have to read them independently).


2021 Update

It‘s now part of Flutter Community Plus (https://plus.fluttercommunity.dev/)

Device Info Plus Docu: https://plus.fluttercommunity.dev/docs/device_info_plus/overview

e.g.:

DeviceInfoPlugin deviceInfo = DeviceInfoPlugin();
if(Platform.isIOS){
  var iosInfo = await deviceInfo.iosInfo;
  if(iosInfo.isPhysicalDevice){...}
}

Tags:

Flutter