nativeconnect 0.0.4
nativeconnect: ^0.0.4 copied to clipboard
The most intuitive Flutter package for seamless native feature integration.
š NativeConnect #
The most intuitive, production-grade Flutter package for seamless native device hardware integration. Interact with Location, Camera, Sensors, and Sharing using a unified, robust one-line static API with automatic permission checks and lifecycle-safe execution.
⨠Key Features #
- š¦ Unified Architecture: Access core hardware capabilities with a single import
import 'package:nativeconnect/nativeconnect.dart';. - š”ļø On-The-Fly Permissions: Checks and requests required OS system permissions automatically, removing boilerplate logic.
- š” Robust GPS Location: Fetch accurate coordinates verifying state of device hardware GPS switches.
- šø Smart Camera: Streamline image capturing from front/rear cameras with automated on-the-fly compression.
- š Battery-Friendly Sensors: Highly optimized real-time 3D accelerometer stream that prevents battery leakage.
- š¤ Universal Sharing: Effortless distribution of application text and media files via native sharing Sheets.
- ā ļø Custom Exception Mapping: Standardized
NativeConnectExceptionhandling standardized across Android & iOS.
š Installation & Setup #
1. Add Dependency #
Include nativeconnect within your pubspec.yaml:
dependencies:
nativeconnect: ^0.0.3
2. Platform Permissions Configuration #
š¤ Android Setup
Add these nodes within android/app/src/main/AndroidManifest.xml:
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<!-- Hardware Capabilities -->
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
</manifest>
š iOS Setup
Append these key-value definitions to ios/Runner/Info.plist:
<key>NSCameraUsageDescription</key>
<string>Application strictly accesses camera to capture imagery payloads.</string>
<key>NSLocationWhenInUseUsageDescription</key>
<string>Application leverages hardware GPS to verify geographic coordinates.</string>
š» Code Usage Reference #
1. Fetch GPS Coordinates (1-Line) #
import 'package:nativeconnect/nativeconnect.dart';
Future<void> getLocation() async {
try {
final position = await NativeConnect.getLocation();
if (position != null) {
print('Lat: ${position.latitude}, Lng: ${position.longitude}');
}
} on NativeConnectException catch (e) {
print('Location Failure: ${e.message}');
}
}
2. Trigger Camera Capture (1-Line) #
import 'package:nativeconnect/nativeconnect.dart';
Future<void> takePhoto() async {
try {
final photo = await NativeConnect.takePhoto(
imageQuality: 85, // Compress 85% automatically
);
if (photo != null) {
print('Photo captured efficiently at path: ${photo.path}');
}
} on NativeConnectException catch (e) {
print('Camera failure: ${e.message}');
}
}
3. Stream Active Sensors (1-Line) #
import 'package:nativeconnect/nativeconnect.dart';
void watchDeviceMotion() {
NativeConnect.watchGravity().listen((GravityData data) {
print('Vector Magnitude scalar is: ${data.magnitude} m/s²');
});
}
4. Share Text & Files (1-Line) #
import 'package:nativeconnect/nativeconnect.dart';
Future<void> shareWithOthers() async {
// Option A: Share pure strings or web links
await NativeConnect.shareText(
text: 'Check out NativeConnect, the ultimate productivity utility!',
);
// Option B: Share media file references
// await NativeConnect.shareFiles(files: [XFile('path/to/my/file.png')]);
}
āļø Author & Creator #
Developed with ā¤ļø by Anit
A passionate developer focused on crafting hyper-efficient Flutter utilities and developer-centric abstraction Layers.
- š¼ LinkedIn: Connect with Anit
- š» GitHub: Anit's Workspace
š”ļø License #
Distributable under standard MIT License Terms - see file LICENSE for rigorous parameters.