Flutter package and sample app to calculate Flight CO2 emissions
Switch branches/tags
Nothing to show
Clone or download
Latest commit d9cf859 Nov 26, 2018
Type Name Latest commit message Commit time
Failed to load latest commit information.
android Initial commit Nov 14, 2018
example Use VerticalSpacing Nov 26, 2018
ios Initial commit Nov 14, 2018
lib Make FlightParameters class private Nov 19, 2018
screenshots Update designs Nov 26, 2018
.gitignore Initial commit Nov 14, 2018
.metadata Initial commit Nov 14, 2018
CHANGELOG.md Update CHANGELOG Nov 19, 2018
LICENSE Updated license Nov 15, 2018
README.md Updated license Nov 15, 2018
pubspec.yaml Add author, homepage to pubspec.yaml Nov 19, 2018


Flight CO2 Calculator


This plugin provides a collection of classes that can be used to:

  • Load a list of airports from the OpenFlights.org dataset.
  • Lookup airports matching a search query against the entire data-set of airports.
  • Calculate the distance and CO2 emissions from flights.

What you can do with this

Build a Flight CO2 Calculator app such as this:

How to use it

Load data:

List<Airport> airports = await AirportDataReader.load('data/airports.dat');

Create an AirportLookup service:

final airportLookup = AirportLookup(airports: airports);

Search for airports matching a query:

List<Airport> results = airportLookup.searchString(query);

Calculate distance and CO2 emissions:

class FlightCalculationData {
  FlightCalculationData({this.distanceKm, this.co2e});
  final double distanceKm;
  final double co2e;

FlightCalculationData _calculate(FlightDetails flightDetails) {
  double distanceKm;
  double co2e;
  Airport departure = flightDetails.departure;
  Airport arrival = flightDetails.arrival;
  if (departure != null && arrival != null) {
    double multiplier =
        flightDetails.flightType == FlightType.oneWay ? 1.0 : 2.0;
    distanceKm = DistanceCalculator.distanceInKmBetween(
        departure.location, arrival.location);
    distanceKm = CO2Calculator.correctedDistanceKm(distanceKm);
    co2e =
        CO2Calculator.calculateCO2e(distanceKm, flightDetails.flightClass) *
  return FlightCalculationData(distanceKm: distanceKm, co2e: co2e);


See the sample Flight CO2 Calculator app bundled with the project in the example folder.

License: MIT