show_qrcode 0.1.1 copy "show_qrcode: ^0.1.1" to clipboard
show_qrcode: ^0.1.1 copied to clipboard

A plugin to show QRCode in Flutter

example/lib/main.dart

import 'package:flutter/material.dart';
import 'dart:async';
import 'dart:io';

import 'package:show_qrcode/show_qrcode.dart';

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

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

class _MyAppState extends State<MyApp> {
  File _imagePath;

  @override
  void initState() {
    super.initState();
    initPlatformState();
  }

  // Platform messages are asynchronous, so we initialize in an async method.
  Future<void> initPlatformState() async {

    // If the widget was removed from the tree while the asynchronous platform
    // message was in flight, we want to discard the reply rather than calling
    // setState to update our non-existent appearance.
    if (!mounted) return;

  }

  _testQR() async {
    _imagePath = await Qrcode.generateQRCode('Test message');
    setState(() {
    });
    print(_imagePath.path);

//    print(await Qrcode.generateQRCode('Test message'));
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Plugin example app'),
        ),
        body: Center(
          child: Column(
            children: <Widget>[
              Container(child: RaisedButton(child: Text('Click'), onPressed: _testQR)),
    _imagePath != null ? Image.file(_imagePath, height: 100,width: 100,) : Container()
            ],
          ),
        ),
      ),
    );
  }
}
1
likes
30
pub points
0%
popularity

Publisher

unverified uploader

A plugin to show QRCode in Flutter

Repository (GitHub)
View/report issues

License

Apache-2.0, BSD-3-Clause (LICENSE)

Dependencies

flutter

More

Packages that depend on show_qrcode