bx_btprinter 0.0.9 copy "bx_btprinter: ^0.0.9" to clipboard
bx_btprinter: ^0.0.9 copied to clipboard

This Flutter plugin allows you to connect to a Bixolon printer via Bluetooth and send print commands. The files in the libs folder belong to Bixolon.

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'webview.dart';
import 'package:bx_btprinter/btprinter.dart';
import 'package:flutter_dotenv/flutter_dotenv.dart';

Future<void> main() async{
  await dotenv.load(fileName: '.env');
  WidgetsFlutterBinding.ensureInitialized();
  runApp(MyApp());
}

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

class _MyAppState extends State<MyApp> {
  final _btprinterPlugin = Btprinter();//플러그인 호출

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

    initBle();// 블루투스 연결 
  }
  void initBle() async {
    // Request BLE permissions from MainActivity
    await _getBle();
  }

  Future<void> _getBle() async {
    String? value;
    try {
      // value = await platform.invokeMethod('getBle');
      value = await _btprinterPlugin.getBtPermission();
    } on PlatformException catch (e) {
      value = 'native code error: ${e.message}';
    }
    //print(value);
  }

  @override
  Widget build(BuildContext context) {
    SystemChrome.setEnabledSystemUIMode(SystemUiMode.immersive);//풀스크린 설정, 화면 로테이션 없음
    
    return MaterialApp(
      debugShowCheckedModeBanner: false,
      home: Scaffold(
        backgroundColor: Colors.white, // 배경을 흰색으로 설정
        body: WebViewContainer(),
      ),
    );
  }
}
4
likes
130
points
67
downloads

Publisher

unverified uploader

Weekly Downloads

This Flutter plugin allows you to connect to a Bixolon printer via Bluetooth and send print commands. The files in the libs folder belong to Bixolon.

Documentation

API reference

License

MIT (license)

Dependencies

change_app_package_name, flutter, plugin_platform_interface

More

Packages that depend on bx_btprinter

Packages that implement bx_btprinter