torch_compat 1.0.0 copy "torch_compat: ^1.0.0" to clipboard
torch_compat: ^1.0.0 copied to clipboard

outdated

Plugin to turn on / off the torch (or flash of the camera)

example/lib/main.dart

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

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

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

class _MyAppState extends State<MyApp> {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Plugin example app'),
        ),
        body: Center(
          child: Column(
            children: <Widget>[
              RaisedButton(
                  child: Text('Turn on'),
                  onPressed: () {
                    TorchCompat.turnOn();
                  }),
              RaisedButton(
                  child: Text('Turn off'),
                  onPressed: () {
                    TorchCompat.turnOff();
                  })
            ],
          ),
        ),
      ),
    );
  }
}
32
likes
0
pub points
78%
popularity

Publisher

verified publisherdaad.mobi

Plugin to turn on / off the torch (or flash of the camera)

Repository (GitHub)
View/report issues

License

unknown (LICENSE)

Dependencies

flutter

More

Packages that depend on torch_compat