awareframework_barometer 0.7.1 copy "awareframework_barometer: ^0.7.1" to clipboard
awareframework_barometer: ^0.7.1 copied to clipboard

The barometer sensor measures the ambient air pressure.

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:awareframework_barometer/awareframework_barometer.dart';

void main() => runApp(new MyApp());

class MyApp extends StatefulWidget {
  @override
  _MyAppState createState() => new _MyAppState();
}

class _MyAppState extends State<MyApp> {
  BarometerSensor? sensor;
  BarometerSensorConfig? config;

  @override
  void initState() {
    super.initState();

    config = BarometerSensorConfig()..debug = true;
    config?.frequency = 1;
    config?.period = 0.1;

    sensor = new BarometerSensor.init(config!);
    sensor?.onDataChanged.listen((data) {
      print(data);
    });

    sensor?.start();
  }

  @override
  Widget build(BuildContext context) {
    return new MaterialApp(
      home: new Scaffold(
        appBar: new AppBar(
          title: const Text('Plugin Example App'),
        ),
      ),
    );
  }
}
0
likes
130
points
26
downloads

Publisher

unverified uploader

Weekly Downloads

The barometer sensor measures the ambient air pressure.

Documentation

API reference

License

unknown (license)

Dependencies

awareframework_core, flutter

More

Packages that depend on awareframework_barometer

Packages that implement awareframework_barometer