flight_co2_calculator_flutter 0.0.1 copy "flight_co2_calculator_flutter: ^0.0.1" to clipboard
flight_co2_calculator_flutter: ^0.0.1 copied to clipboard

Flutter package and sample app to calculate Flight CO2 emissions.

example/lib/main.dart

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),
      ),
    );
  }
}
1
likes
40
pub points
0%
popularity

Publisher

verified publishercodewithandrea.com

Flutter package and sample app to calculate Flight CO2 emissions.

Repository (GitHub)
View/report issues

License

MIT (license)

Dependencies

flutter

More

Packages that depend on flight_co2_calculator_flutter