Installation
Requirements
Section titled “Requirements”| Minimum | |
|---|---|
| Flutter | 3.44.8 (Dart 3.12.2) |
| Android | API 21 (Android 5.0) |
| iOS | 15.0 |
Add the package
Section titled “Add the package”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:
dependencies: device_shield: git: url: https://github.com/Vikaskumar75/device-shield.git path: app ref: <commit-sha>Then:
flutter pub getImport it:
import 'package:device_shield/device_shield.dart';Platform setup
Section titled “Platform setup”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.
Set your deployment target to iOS 15.0 or later. If you want the
location-based mock-location signals, add a location usage description to
Info.plist and request authorisation yourself.
See iOS setup.
iOS: Swift Package Manager and CocoaPods
Section titled “iOS: Swift Package Manager and CocoaPods”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.
Verify the install
Section titled “Verify the install”-
Run a check on a device, emulator or simulator:
final report = await DeviceShield.check();debugPrint('${report.all}'); -
On an Android emulator or the iOS Simulator,
emulatorshould bedetected, withhardwareandproduct(Android) orsimulator_target(iOS) among its signals.