SensorLab provides a comprehensive collection of sensor modules and utilities for Flutter applications. Each module is designed with Clean Architecture principles and includes complete integration guides.
- Accelerometer - 3-axis acceleration measurement with gesture detection
- Gyroscope - Angular velocity measurement and device rotation tracking
- Compass - Magnetic orientation detection with cardinal directions
- Geolocator - GPS positioning with distance calculations and geofencing
- Light Meter - Ambient light measurement for photography and brightness control
- Noise Meter - Sound level measurement with decibel readings
- Humidity - Environmental moisture monitoring with comfort indicators
- Proximity - Object detection for screen management and gestures
- Health - Comprehensive health tracking with activity monitoring
- Heart Beat - Heart rate monitoring using camera-based photoplethysmography
- QR Scanner - Advanced QR/barcode scanning with batch processing
- Flashlight - LED torch control with brightness and strobe modes
- App Settings - Centralized configuration and user preferences
All modules follow the same architectural pattern:
lib/
├── models/ # Data entities and value objects
├── services/ # Business logic and use cases
├── screens/ # UI presentation layer
└── widgets/ # Reusable UI components
class SensorData {
final double value;
final DateTime timestamp;
final String? unit;
// Add computed properties and validation
}final sensorProvider = StreamProvider<SensorData>((ref) {
return SensorService().dataStream.map((data) =>
SensorData(value: data, timestamp: DateTime.now())
);
});class SensorScreen extends ConsumerWidget {
@override
Widget build(BuildContext context, WidgetRef ref) {
final sensorData = ref.watch(sensorProvider);
return sensorData.when(
data: (data) => SensorDisplay(data: data),
loading: () => LoadingIndicator(),
error: (error, _) => ErrorDisplay(error: error),
);
}
}- Add required dependencies to
pubspec.yaml - Configure permissions for target platforms
- Initialize providers in your app
- Implement UI components or use provided screens
dependencies:
flutter_riverpod: ^2.4.9
sensors_plus: ^4.0.2
permission_handler: ^11.1.0
# Module-specific dependencies listed in each module doc<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-permission android:name="android.permission.VIBRATE" /><key>NSCameraUsageDescription</key>
<string>Camera access required for QR scanning and heart rate monitoring</string>
<key>NSLocationWhenInUseUsageDescription</key>
<string>Location access required for GPS features</string>
<key>NSMicrophoneUsageDescription</key>
<string>Microphone access required for noise level measurement</string>| Module | Android | iOS | Web | Windows | macOS | Linux |
|---|---|---|---|---|---|---|
| Accelerometer | ✅ | ✅ | ❌ | ❌ | ❌ | ❌ |
| Gyroscope | ✅ | ✅ | ❌ | ❌ | ❌ | ❌ |
| Compass | ✅ | ✅ | ❌ | ❌ | ❌ | ❌ |
| Geolocator | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
| Light Meter | ✅ | ✅ | ❌ | ❌ | ❌ | ❌ |
| Noise Meter | ✅ | ✅ | ❌ | ❌ | ❌ | ❌ |
| QR Scanner | ✅ | ✅ | ✅ | ❌ | ❌ | ❌ |
| Flashlight | ✅ | ✅ | ❌ | ❌ | ❌ | ❌ |
// Watch sensor data
final accelerometer = ref.watch(accelerometerProvider);
accelerometer.when(
data: (data) => Text('X: ${data.x.toStringAsFixed(2)}'),
loading: () => CircularProgressIndicator(),
error: (error, _) => Text('Error: $error'),
);// Create custom provider combining multiple sensors
final motionProvider = Provider<MotionData>((ref) {
final accel = ref.watch(accelerometerProvider).value;
final gyro = ref.watch(gyroscopeProvider).value;
return MotionData(
acceleration: accel,
rotation: gyro,
timestamp: DateTime.now(),
);
});- Real-time filtering and smoothing
- Calibration and offset correction
- Multi-sensor fusion algorithms
- Statistical analysis and trending
- CSV/JSON data export
- Real-time data streaming
- Cloud synchronization
- Batch processing capabilities
- Configurable update rates
- Custom UI themes and layouts
- Localization support (4 languages)
- Accessibility features
- Project Architecture - Complete technical architecture overview
- Main README - Setup instructions and project overview
- Release Notes - Latest updates and improvements
When adding new modules, follow these guidelines:
- Structure: Follow the established Clean Architecture pattern
- Documentation: Create comprehensive module documentation
- Testing: Include unit and integration tests
- Localization: Add translations for all user-facing text
- Platform Support: Document platform-specific limitations
For detailed contribution guidelines, see the main README.md file.