If you're working with the package locally:
# pubspec.yaml
dependencies:
snore_detection:
path: ../snore_detection# pubspec.yaml
dependencies:
snore_detection:
git:
url: https://github.com/metanav/Snoring_Guardian.git
path: snore_detection# pubspec.yaml
dependencies:
snore_detection: ^0.2.0-
Minimum SDK Version: Ensure
android/app/build.gradlehas:android { defaultConfig { minSdkVersion 21 // Minimum required } }
-
Permissions: Add to
android/app/src/main/AndroidManifest.xml:<manifest xmlns:android="http://schemas.android.com/apk/res/android"> <uses-permission android:name="android.permission.RECORD_AUDIO" /> <application> ... </application> </manifest>
-
Minimum iOS Version: Ensure
ios/Podfilehas:platform :ios, '12.0' # Minimum required
-
Microphone Permission: Add to
ios/Runner/Info.plist:<key>NSMicrophoneUsageDescription</key> <string>This app needs microphone access to detect snoring</string>
-
Run pod install:
cd ios pod install cd ..
Create a test file to verify the package is working:
// test_installation.dart
import 'package:snore_detection/snore_detection.dart';
Future<void> testInstallation() async {
print('Testing Flutter Snore Detection package...');
final detector = SnoreDetector();
try {
print('Initializing detector...');
await detector.initialize();
print('✅ Detector initialized successfully!');
print('Package is working correctly.');
detector.dispose();
} catch (e) {
print('❌ Error: $e');
}
}Solution: Run flutter pub get in your project directory:
flutter pub getSolution:
- Stop your app
- Run:
flutter clean - Run:
flutter pub get - For iOS:
cd ios && pod install && cd .. - Rebuild and run your app
Solution: Update your android/app/build.gradle:
android {
defaultConfig {
minSdkVersion 21 // Update this
}
}Solution:
cd ios
rm -rf Pods
rm Podfile.lock
pod install
cd ..
flutter clean
flutter runSolution: The package will automatically download the TFLite native libraries on first build. Ensure you have internet connection during the first build.
The package uses the following dependencies:
- tflite_flutter (^0.9.0): TensorFlow Lite runtime for Flutter
- record (^5.0.4): Audio recording capabilities
- permission_handler (^11.3.0): Runtime permissions handling
- path_provider (^2.1.2): File system access
- fftea (^1.0.0): Fast Fourier Transform for audio processing
All dependencies will be automatically installed when you run flutter pub get.
Run these commands to verify everything is set up correctly:
# Check Flutter version (should be 3.0.0 or higher)
flutter --version
# Check for any setup issues
flutter doctor
# Get dependencies
flutter pub get
# Analyze for any errors
flutter analyze
# Run the example app
cd example
flutter runOnce installation is complete:
- Read the Getting Started Guide
- Check out the API Documentation
- Run the Example App
- Start building!
If you encounter any installation issues not covered here:
- Check the GitHub Issues
- Create a new issue with:
- Your Flutter version (
flutter --version) - Your platform (Android/iOS)
- Full error message
- Steps to reproduce
- Your Flutter version (
After installation, test with this minimal example:
import 'package:flutter/material.dart';
import 'package:snore_detection/snore_detection.dart';
void main() async {
WidgetsFlutterBinding.ensureInitialized();
final detector = SnoreDetector();
await detector.initialize();
print('Package installed and working!');
runApp(MyApp());
}
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
body: Center(
child: Text('Flutter Snore Detection is ready!'),
),
),
);
}
}If this runs without errors, your installation is successful!