light_sensor 2.0.0 copy "light_sensor: ^2.0.0" to clipboard
light_sensor: ^2.0.0 copied to clipboard

outdated

A new flutter plugin project.

example/lib/main.dart

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

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

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

  final LightSensor _light = LightSensor();

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
        home: Scaffold(
            appBar: AppBar(title: const Text('Plugin example app')),
            body: Center(
                child: StreamBuilder<int>(
                    stream: _light.lightSensorStream,
                    builder: (context, snapshot) {
                      if (snapshot.hasData) {
                        return Text('Running on: ${snapshot.data} LUX');
                      } else {
                        return const Text('Running on: unknown');
                      }
                    }))));
  }
}
8
likes
0
points
102
downloads

Publisher

unverified uploader

Weekly Downloads

A new flutter plugin project.

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

flutter

More

Packages that depend on light_sensor