NativeLens
NativeLens is a Flutter capability intelligence SDK with deep Android support and initial iOS foundation support. It uses Platform Channels to inspect native device capabilities, build runtime reports, and run offline compatibility analysis from Dart.
NativeLens is designed for apps that need a clear, developer-friendly snapshot of the device they are running on without adding a backend, AI service, or heavy dashboard layer.
Key Features
- Android platform summary, including manufacturer, brand, model, SDK, and Android release.
- System feature matrix from Android PackageManager.
- Sensor capability profiling from SensorManager.
- Display capability profiling, including density, refresh rates, and HDR.
- Media codec capability profiling, including encoder and decoder support.
- Camera2 capability profiling without opening the camera or requiring camera permission.
- Power and battery runtime state.
- Network capability snapshots and real-time network capability updates.
- App-level network speed stream based on this app UID traffic.
- Full NativeLens report aggregation.
- Offline compatibility summary using simple Dart rules.
Installation
Add NativeLens to your pubspec.yaml:
dependencies:
native_lens: ^0.4.0
Then run:
flutter pub get
Platform Support
| Platform | Support level |
|---|---|
| Android | Deep native capability support for platform summary, sensors, display, media codecs, camera capabilities, power state, and network diagnostics |
| iOS | Foundation support with platform summary, power state, network capability, device orientation, and safe fallbacks for unsupported deep capability modules |
Basic Usage
Import the package:
import 'package:native_lens/native_lens.dart';
Create a NativeLens instance:
final NativeLens nativeLens = NativeLens();
What's new in v0.2.0
- Screen Debug Trace: debug-only assert-based screen traces for development.
- Device Orientation APIs: one-shot
getDeviceOrientation()anddeviceOrientationStream. - Example app: refactored into a professional diagnostics dashboard UI.
- Android fix: use
Surfacerotation constants to resolve build issues.
Screen Debug Trace
Wrap your screen widgets with NativeLensScreenTrace to print the current
screen name, source file path, and route name during development.
NativeLensScreenTrace(
screenName: 'ProductDetailsScreen',
filePath: 'lib/features/product/product_details_screen.dart',
routeName: '/product-details',
child: ProductDetailsView(),
)
On debug builds the console output will be:
[NativeLens] Screen Debug
Screen: ProductDetailsScreen
File: lib/features/product/product_details_screen.dart
Route: /product-details
The trace is emitted only when asserts are enabled. It does not print in release builds.
Platform Summary
final PlatformSummary summary = await nativeLens.getPlatformSummary();
print(summary.manufacturer);
print(summary.model);
print(summary.androidRelease);
Full Runtime Report
final NativeLensReport report = await nativeLens.generateReport();
print(report.platformSummary);
print('Features: ${report.systemFeatures.length}');
print('Sensors: ${report.sensors.length}');
print('Codecs: ${report.mediaCodecs.length}');
print('Cameras: ${report.cameraCapabilities.length}');
Compatibility Summary
final CompatibilitySummary summary = await nativeLens.analyzeCompatibility();
print(summary.overallScore);
print(summary.overallLevel);
print(summary.warnings);
print(summary.recommendations);
The compatibility summary is generated locally with simple Dart rules. It does not call an AI API, backend, paid service, or remote model.
Dataset Pipeline
Generate a stable dataset row from the current NativeLens report and compatibility summary:
final NativeLensDatasetRow row = await nativeLens.generateDatasetRow();
print(row.platform);
print(row.overallScore);
print(row.riskLevel);
Export one row to JSON:
final String json = NativeLensDatasetExporter.toJson(row);
print(json);
Export one or more rows to CSV:
final String csv = NativeLensDatasetExporter.toCsv(<NativeLensDatasetRow>[row]);
print(csv);
Live Network Capability Updates
final Stream<NetworkCapability> stream = nativeLens.networkCapabilityStream;
stream.listen((NetworkCapability capability) {
print(capability.isConnected ? 'Connected' : 'Disconnected');
print(capability.transportType);
});
App Traffic Speed Stream
final Stream<NetworkSpeedSample> stream = nativeLens.networkSpeedStream;
stream.listen((NetworkSpeedSample sample) {
print('Download: ${sample.rxKbps} kbps');
print('Upload: ${sample.txKbps} kbps');
});
networkSpeedStream measures this app UID traffic with Android TrafficStats. It
is not a full internet speed test and does not use device-wide network stats.
Device Orientation
Get the current device orientation snapshot from Android:
final DeviceOrientationInfo orientation =
await nativeLens.getDeviceOrientation();
print(orientation.orientationName);
print(orientation.rotationDegrees);
print(orientation.isPortrait);
print(orientation.isLandscape);
Listen for live orientation updates:
nativeLens.deviceOrientationStream.listen((DeviceOrientationInfo orientation) {
print('Orientation: ${orientation.orientationName}');
print('Rotation degrees: ${orientation.rotationDegrees}');
});
Privacy
NativeLens focuses on device capability and runtime state. It does not collect:
- Unique device identifiers.
- Contacts.
- Photos.
- Location.
- Device-wide network usage statistics.
Network speed samples are based on this app UID traffic only.
Android Permissions
NativeLens uses:
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
This permission is used for network capability detection, including connection status, transport type, validated internet state, metered state, and related network capability flags.
NativeLens does not request camera permission for camera capability profiling. It reads Camera2 metadata only and does not open the camera or capture media.
Current Limitations
- Deep Android capability support remains the primary focus.
- iOS support is currently foundational and safe-fallback oriented.
- No AI model yet.
- No macOS, Windows, Linux, or web implementation yet.
Author
- Portfolio: https://bynahin.onrender.com/
- Pub.dev: https://pub.dev/packages/native_lens
Repository
- Homepage: https://github.com/Nahin-CDR/native_lens
- Repository: https://github.com/Nahin-CDR/native_lens
- Issues: https://github.com/Nahin-CDR/native_lens/issues
Libraries
- camera_capability
- compatibility_summary
- device_orientation_info
- display_info
- media_codec_capability
- native_lens
- native_lens_dataset_exporter
- native_lens_dataset_row
- native_lens_debug
- native_lens_method_channel
- native_lens_platform_interface
- native_lens_report
- native_lens_screen_trace
- native_sensor
- network_capability
- network_speed_sample
- platform_summary
- power_state
- screen_debug_info
- system_feature