Skip to content

Divyansh-Gemini/flight-ticket-scanner

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Flight Ticket Scanner ✈️

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.

🚀 Features

  • 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.

🛠️ Tech Stack

  • 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

📂 Project Structure

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

⚡ Getting Started

1. Prerequisites

  • Flutter SDK installed (Version 3.0.0+)
  • An Android/iOS device or emulator.
  • A RapidAPI Account (for the API Key).

2. API Key Setup

This project uses AeroDataBox for flight data.

  1. Go to RapidAPI - AeroDataBox.
  2. Subscribe to the Free Tier.
  3. Copy your X-RapidAPI-Key.

3. Installation

Clone the repository:

git clone https://github.com/Divyansh-Gemini/flight-ticket-scanner.git
cd flight-ticket-scanner

Install dependencies:

flutter pub get

4. Running the App

To 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_HERE

Note: For VS Code users, you can add this to your launch.json args.

📸 Usage Guide

  1. Launch the App: Open Flight Ticket Scanner.
  2. Select File: Tap "Select Image or PDF".
  3. Processing:
    • Images: Scanned immediately.
    • PDFs: The app renders each page internally and scans for barcodes.
  4. 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.

🛡️ Privacy & Security

  • 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.

🤝 Contributing

Contributions are welcome! Please fork the repository and submit a pull request for any enhancements or bug fixes.

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

About

A Flutter app that scans physical & digital boarding passes (PDF/Image) to extract PNR and passenger details, enriching them with live terminal & gate info via the AeroDataBox API.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages