flight_co2_calculator_flutter 0.0.1 flight_co2_calculator_flutter: ^0.0.1 copied to clipboard
Flutter package and sample app to calculate Flight CO2 emissions.
import 'package:flight_co2_calculator_flutter/airport.dart';
import 'package:flight_co2_calculator_flutter/airport_data_reader.dart';
import 'package:flight_co2_calculator_flutter/airport_lookup.dart';
import 'package:flight_co2_calculator_flutter_example/app/flight_page.dart';
import 'package:flight_co2_calculator_flutter_example/blocs/bloc_provider.dart';
import 'package:flight_co2_calculator_flutter_example/blocs/flight_details_bloc.dart';
import 'package:flutter/material.dart';
void main() async {
final start = DateTime.now();
List<Airport> airports = await AirportDataReader.load('data/airports.dat');
final elapsed = DateTime.now().difference(start);
print('Loaded airports data in $elapsed');
runApp(MyApp(airportLookup: AirportLookup(airports: airports)));
}
class MyApp extends StatelessWidget {
MyApp({this.airportLookup});
final AirportLookup airportLookup;
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flight CO2 calculator',
debugShowCheckedModeBanner: false,
theme: ThemeData(
primarySwatch: Colors.blue,
),
home: BlocProvider<FlightDetailsBloc>(
bloc: FlightDetailsBloc(),
child: FlightPage(airportLookup: airportLookup),
),
);
}
}