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

PlatformAndroid
outdated

A flutter package for work with sensors.

example/lib/main.dart

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

void main() {
  runApp(const MyApp());
}

class MyApp extends StatefulWidget {
  const MyApp({Key? key}) : super(key: key);

  @override
  State<MyApp> createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  String text = '';
  String proximityText = '';
  @override
  void initState() {
    super.initState();
    // Sensors.listenToLightSensor((value){
    //   setState(() {
    //     text = value;
    //   });
    // });
    DeviceSensors.listenToProximitySensor((value){
      setState(() {
        proximityText = value;
      });
    });
  }


  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Plugin example app'),
        ),
        body: Center(
          child: Text('Lightness : $text \t Proximity : $proximityText'),
        ),
      ),
    );
  }
}
0
likes
110
points
12
downloads

Publisher

unverified uploader

Weekly Downloads

A flutter package for work with sensors.

Homepage

Documentation

API reference

License

unknown (license)

Dependencies

flutter

More

Packages that depend on device_sensors

Packages that implement device_sensors