use_camera 0.0.3 copy "use_camera: ^0.0.3" to clipboard
use_camera: ^0.0.3 copied to clipboard

A simple Flutter plugin for using camera with OpenCV

example/lib/main.dart

import 'dart:async';

// import 'package:flutter/services.dart';

// class UseCamera {
//   static const MethodChannel _channel =
//       const MethodChannel('useCamera');

//   static Future<String> get platformVersion async {
//     final String version = await _channel.invokeMethod('getPlatformVersion');
//     return version;
//   }
// }
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';

void main() {
  runApp(UseCamera());
}

class UseCamera extends StatelessWidget {
  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Plugin',
      theme: ThemeData(
        primarySwatch: Colors.blue,
        visualDensity: VisualDensity.adaptivePlatformDensity,
      ),
      home: MyHomePage(title: 'Flutter Plugin Home Page'),
    );
  }
}

class MyHomePage extends StatefulWidget {
  MyHomePage({Key key, this.title}) : super(key: key);
  final String title;

  @override
  _MyHomePageState createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  int _counter = 0;
  static const platform = const MethodChannel('useCamera');

  void _incrementCounter() {
    setState(() {
      _counter++;
    });
  }

  Future<Null> _useCamera() async {
    
    try {
      
      final int result = await platform.invokeMethod('useCamera');
      
    } on Exception catch (e) {
      print(e);
    }
  }

  @override
  Widget build(BuildContext context) {
    return new Material(
    child: new Center(
      child: new Column(
        mainAxisAlignment: MainAxisAlignment.spaceEvenly,
        children: [
          new RaisedButton(
            child: new Text('Use Camera'),
            onPressed: _useCamera,
          )
        ],
      ),
    ),
  );
  }
}
0
likes
30
pub points
0%
popularity

Publisher

unverified uploader

A simple Flutter plugin for using camera with OpenCV

Homepage

License

MIT (LICENSE)

Dependencies

flutter

More

Packages that depend on use_camera