MediLocker is a Flutter mobile application for securely storing and managing medical records such as prescriptions, lab reports, and X-ray images. It uses Firebase Authentication, Firestore, Firebase Storage, Google ML Kit OCR, AI-based report summarization, and local medicine reminders.
- Google Sign-In with Firebase Authentication
- Dashboard with quick actions for upload, reports, reminders, and profile
- Upload medical reports from camera or file picker
- Firebase Storage upload and Firestore metadata tracking
- OCR text extraction for image-based reports using Google ML Kit
- AI summary generation using Gemini API or OpenAI API
- Reports list with thumbnails, upload dates, and summary previews
- Report detail page with extracted text and sharing actions
- Medicine reminders using
flutter_local_notifications - Bottom navigation and healthcare-themed Material 3 UI
lib/
models/
screens/
services/
utils/
widgets/
firebase_corefirebase_authcloud_firestorefirebase_storagegoogle_sign_ingoogle_mlkit_text_recognitionimage_pickerfile_pickerhttpflutter_local_notificationstimezoneshare_plusurl_launcher
- Install Flutter and verify with:
flutter doctor- Open the project:
cd /Users/palakpandit/Documents/New\ project/medilocker-
Create a Firebase project in the Firebase console.
-
Enable these Firebase products:
- Authentication
- Cloud Firestore
- Storage
-
Enable Google Sign-In inside Firebase Authentication.
-
Configure FlutterFire:
dart pub global activate flutterfire_cli
flutterfire configureThis generates platform-specific Firebase configuration. You can keep the existing lib/firebase_options.dart placeholder file or replace it with the generated one.
- For Android, add your SHA-1 and SHA-256 fingerprints in Firebase so Google Sign-In works.
You also need the Web OAuth client ID as the Google server client ID for Android sign-in with google_sign_in v7. Pass it with --dart-define=GOOGLE_SERVER_CLIENT_ID=....
- For iOS:
- Add
GoogleService-Info.plisttoios/Runner/ - Open
ios/Runner.xcworkspacein Xcode - Add the reversed client ID to URL Types
- Set your AI provider and API key using
--dart-define.
Gemini example:
flutter run \
--dart-define=GOOGLE_SERVER_CLIENT_ID=YOUR_FIREBASE_WEB_CLIENT_ID \
--dart-define=AI_PROVIDER=gemini \
--dart-define=AI_API_KEY=YOUR_GEMINI_API_KEY \
--dart-define=AI_MODEL=gemini-1.5-flashOpenAI example:
flutter run \
--dart-define=GOOGLE_SERVER_CLIENT_ID=YOUR_FIREBASE_WEB_CLIENT_ID \
--dart-define=AI_PROVIDER=openai \
--dart-define=AI_API_KEY=YOUR_OPENAI_API_KEY \
--dart-define=AI_MODEL=gpt-4.1-mini- Install dependencies and run:
flutter pub get
flutter run{
"userId": "firebase-user-id",
"reportType": "prescription",
"uploadDate": "timestamp",
"fileURL": "https://storage-download-url",
"fileName": "report.jpg",
"mimeType": "image/jpeg",
"extractedText": "OCR result",
"aiSummary": "Patient-friendly summary"
}{
"userId": "firebase-user-id",
"medicineName": "Amoxicillin",
"timeOfDay": "09:00",
"durationDays": 7,
"createdAt": "timestamp"
}rules_version = '2';
service cloud.firestore {
match /databases/{database}/documents {
match /reports/{reportId} {
allow read, write: if request.auth != null && request.auth.uid == request.resource.data.userId;
}
match /reminders/{reminderId} {
allow read, write: if request.auth != null && request.auth.uid == request.resource.data.userId;
}
match /users/{userId} {
allow read, write: if request.auth != null && request.auth.uid == userId;
}
}
}
rules_version = '2';
service firebase.storage {
match /b/{bucket}/o {
match /medical_reports/{userId}/{allPaths=**} {
allow read, write: if request.auth != null && request.auth.uid == userId;
}
}
}
- OCR currently runs on image files. PDFs are uploaded and organized, but not OCR-processed by this version.
- If no AI API key is set, the app falls back to a basic local preview summary.
- Use a real generated
firebase_options.dartbefore production deployment.