A robust Flutter application that scans physical or digital boarding passes (PDFs & Images) to extract flight details, PNR, and passenger information. It enriches the scanned data with real-time terminal and gate information using the AeroDataBox API.
- Multi-Format Scanning: Supports PDF (multi-page) and Image (JPG/PNG) files.
- IATA Standard Parsing: Decodes standard BCBP (Bar Coded Boarding Pass) PDF417/Aztec codes.
- Smart Flight Detection:
- Detects multiple flights in a single file (e.g., Round trips, Layovers).
- De-duplicates repeated scans.
- Handles "Unassigned" seating logic.
- Real-Time API Enrichment: Fetches live Terminal, Gate, and UTC timings via AeroDataBox API.
- Smart Chronology: Automatically infers the correct flight year (Current vs. Next Year) based on scan date.
- Rate Limiting: Intelligent throttling to respect API usage limits (1 req/sec).
- Privacy Focused: Barcode processing happens entirely on-device using Google ML Kit.
- Framework: Flutter (Dart)
- Barcode Scanning:
google_mlkit_barcode_scanning - PDF Handling:
pdfx(Rendering pages to images for scanning) - Networking:
http - File Picker:
file_picker - API Provider: AeroDataBox via RapidAPI
lib/
├── main.dart # UI, State Management & Scanning Logic
├── app_theme.dart # App Colors & Theme Configuration
├── boarding_pass_parser.dart # Regex logic for IATA BCBP parsing
└── flight_api_service.dart # HTTP calls to RapidAPI
- Flutter SDK installed (Version 3.0.0+)
- An Android/iOS device or emulator.
- A RapidAPI Account (for the API Key).
This project uses AeroDataBox for flight data.
- Go to RapidAPI - AeroDataBox.
- Subscribe to the Free Tier.
- Copy your
X-RapidAPI-Key.
Clone the repository:
git clone https://github.com/Divyansh-Gemini/flight-ticket-scanner.git
cd flight-ticket-scannerInstall dependencies:
flutter pub getTo keep your API key secure, this project uses compile-time variables. Do not hardcode your key in the Dart files.
Run the app using the --dart-define flag:
flutter run --dart-define=RAPID_API_KEY=YOUR_ACTUAL_API_KEY_HERENote: For VS Code users, you can add this to your launch.json args.
- Launch the App: Open Flight Ticket Scanner.
- Select File: Tap "Select Image or PDF".
- Processing:
- Images: Scanned immediately.
- PDFs: The app renders each page internally and scans for barcodes.
- View Results:
- Valid tickets appear as detailed cards with Origin, Destination, and PNR.
- The app auto-fetches Terminal details (orange badge).
- Raw data is displayed at the bottom for debugging.
- Barcode Parsing: Performed locally on the device using ML Kit. No boarding pass images are uploaded to any server.
- API Requests: Only the Flight Number and Date are sent to the API provider to fetch terminal details. PNR and Passenger Names remain local.
Contributions are welcome! Please fork the repository and submit a pull request for any enhancements or bug fixes.
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature) - Commit your Changes (
git commit -m 'Add some AmazingFeature') - Push to the Branch (
git push origin feature/AmazingFeature) - Open a Pull Request