aeyrium_sensor 1.0.7 icon indicating copy to clipboard operation
aeyrium_sensor: ^1.0.7 copied to clipboard

A Flutter sensor plugin which provide easy access to the Pitch and Roll on Android and iOS devices.

example/lib/main.dart

import 'dart:async';

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

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

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

class _MyAppState extends State<MyApp> {
  String _data = "";

  StreamSubscription<dynamic> _streamSubscriptions;

  @override
  void initState() {
    _streamSubscriptions = AeyriumSensor.sensorEvents.listen((event) {
      setState(() {
        _data = "Pitch ${event.pitch} , Roll ${event.roll}";
      });
    });
    super.initState();
  }

  @override
  void dispose() {
    if (_streamSubscriptions != null) {
      _streamSubscriptions.cancel();
    }
    super.dispose();
  }

  @override
  Widget build(BuildContext context) {
    return new MaterialApp(
      home: new Scaffold(
        appBar: new AppBar(
          title: const Text('Plugin example app'),
        ),
        body: Padding(
          padding: const EdgeInsets.all(15.0),
          child: new Center(
            child: new Text('Device : $_data'),
          ),
        ),
      ),
    );
  }
}
14
likes
95
pub points
64%
popularity

Publisher

verified publisher iconaeyrium.com

A Flutter sensor plugin which provide easy access to the Pitch and Roll on Android and iOS devices.

Homepage
Repository (GitHub)
View/report issues

Documentation

API reference

License

Icon for licenses.MIT (LICENSE)

Dependencies

flutter

More

Packages that depend on aeyrium_sensor