Skip to content

Installation

Minimum
Flutter 3.44.8 (Dart 3.12.2)
Android API 21 (Android 5.0)
iOS 15.0

device_shield isn’t published to pub.dev yet. Until it is, depend on the Git repository and pin a commit so a later change can’t break your build:

pubspec.yaml
dependencies:
device_shield:
git:
url: https://github.com/Vikaskumar75/device-shield.git
path: app
ref: <commit-sha>

Then:

Terminal window
flutter pub get

Import it:

import 'package:device_shield/device_shield.dart';

No changes are required. The plugin’s manifest entries merge into your app automatically. If you want the location-based mock-location signals, your app must request location permission itself.

See Android setup for what gets merged and why.

The plugin ships a Swift package (used by default in recent Flutter versions) and a podspec for CocoaPods. So far, only Swift Package Manager resolution in a separate app has been checked. A full app build and the CocoaPods path haven’t been verified yet.

  1. Run a check on a device, emulator or simulator:

    final report = await DeviceShield.check();
    debugPrint('${report.all}');
  2. On an Android emulator or the iOS Simulator, emulator should be detected, with hardware and product (Android) or simulator_target (iOS) among its signals.