{"id":19519041,"url":"https://github.com/bizz84/flight_co2_calculator_flutter","last_synced_at":"2025-04-26T07:31:04.933Z","repository":{"id":56828910,"uuid":"157781887","full_name":"bizz84/flight_co2_calculator_flutter","owner":"bizz84","description":"Flutter package and sample app to calculate Flight CO2 emissions","archived":false,"fork":false,"pushed_at":"2020-03-14T16:27:06.000Z","size":1924,"stargazers_count":57,"open_issues_count":5,"forks_count":20,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-04-26T06:02:28.633Z","etag":null,"topics":["android","dart","flutter","ios"],"latest_commit_sha":null,"homepage":"https://codewithandrea.com/","language":"Dart","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bizz84.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-11-15T22:42:59.000Z","updated_at":"2024-12-15T00:47:35.000Z","dependencies_parsed_at":"2022-08-26T13:50:53.919Z","dependency_job_id":null,"html_url":"https://github.com/bizz84/flight_co2_calculator_flutter","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bizz84%2Fflight_co2_calculator_flutter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bizz84%2Fflight_co2_calculator_flutter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bizz84%2Fflight_co2_calculator_flutter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bizz84%2Fflight_co2_calculator_flutter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bizz84","download_url":"https://codeload.github.com/bizz84/flight_co2_calculator_flutter/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250953320,"owners_count":21513296,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["android","dart","flutter","ios"],"created_at":"2024-11-11T00:16:01.214Z","updated_at":"2025-04-26T07:31:04.490Z","avatar_url":"https://github.com/bizz84.png","language":"Dart","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Flight CO2 Calculator \n\n## About\n\nThis plugin provides a collection of classes that can be used to:\n\n- Load a list of airports from the [OpenFlights.org dataset](https://openflights.org/data.html).\n- Lookup airports matching a search query against the entire data-set of airports. \n- Calculate the distance and CO2 emissions from flights.\n\n## What you can do with this\n\nBuild a Flight CO2 Calculator app such as this:\n\n![](screenshots/FlightCalculator-screenshots.png)\n\n## How to use it\n\nLoad data:\n\n```dart\nList\u003cAirport\u003e airports = await AirportDataReader.load('data/airports.dat');\n```\n\nCreate an `AirportLookup` service:\n\n```dart\nfinal airportLookup = AirportLookup(airports: airports);\n```\n\nSearch for airports matching a query:\n\n```dart\nList\u003cAirport\u003e results = airportLookup.searchString(query);\n```\n\nCalculate distance and CO2 emissions:\n\n```dart\nclass FlightCalculationData {\n  FlightCalculationData({this.distanceKm, this.co2e});\n  final double distanceKm;\n  final double co2e;\n}\n\nFlightCalculationData _calculate(FlightDetails flightDetails) {\n  double distanceKm;\n  double co2e;\n  Airport departure = flightDetails.departure;\n  Airport arrival = flightDetails.arrival;\n  if (departure != null \u0026\u0026 arrival != null) {\n    double multiplier =\n        flightDetails.flightType == FlightType.oneWay ? 1.0 : 2.0;\n    distanceKm = DistanceCalculator.distanceInKmBetween(\n        departure.location, arrival.location);\n    distanceKm = CO2Calculator.correctedDistanceKm(distanceKm);\n    co2e =\n        CO2Calculator.calculateCO2e(distanceKm, flightDetails.flightClass) *\n            multiplier;\n  }\n  return FlightCalculationData(distanceKm: distanceKm, co2e: co2e);\n}\n```\n\n## Example\n\nSee the sample Flight CO2 Calculator app bundled with the project in the `example` folder.\n\n### [License: MIT](LICENSE)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbizz84%2Fflight_co2_calculator_flutter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbizz84%2Fflight_co2_calculator_flutter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbizz84%2Fflight_co2_calculator_flutter/lists"}