platform_detail
5.5.0, released 5 months ago by victorcarreras.dev
Obtain current platform, device info, IP addresses, theme, and app version details.
What it does
Provides a unified static API to detect the current platform (including web), check device groups like mobile or desktop, fetch private and public IP addresses, detect light or dark theme, and retrieve device/app version details.
AI-written summary of version 5.5.0, based on the package's README and metadata. Report an inaccuracy
Use it when
- You need a cross-platform solution that supports web platform detection alongside mobile and desktop.
- You need to retrieve app package metadata, environment details, or device info easily.
- You need to check if the device is in light or dark mode.
Skip it when
- You only need standard Flutter APIs and do not mind implementing manual web checks via kIsWeb.
- You require a complex backend solution for network routing or HTTP requests.
Strengths
- Unified API across all platforms including web.
- Provides helper methods for IP detection, device theme, and app version metadata.
- Includes built-in mocked capabilities for testing.
Weaknesses
- Requires platform-specific configuration on macOS for certain features like network client entitlements to fetch IP addresses.
Setup
- Kind
- Flutter widgets
- Effort
- Low
- Code generation
- No
- Direct dependencies
- 3
For macOS, you must add the com.apple.security.network.client entitlement to both DebugProfile.entitlements and ReleaseProfile.entitlements files to detect IP addresses.
import 'package:platform_detail/platform_detail.dart';
void main() {
PlatformType platform = PlatformDetail.currentPlatform;
print('This platform is: $platform');
}Works with
Packages commonly used together with platform_detail: ones it builds on, ones built on it, and its own family.
- package_info_plusplatform_detail depends on itFlutter plugin to query app package info like version, build number and installer store.
- dioplatform_detail depends on itA powerful HTTP networking package for Dart and Flutter with interceptors and request cancellation.
- device_info_plusplatform_detail depends on itProvides detailed information about the current device, make, model, and OS version.