You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Future initPrint() async {
// all method from imin printer need to async await
await iminPrinter.initPrinter().then((value) {
print('init ${value.toString()}');
}); // must init the printer first. for more exmaple.. pls refer to example tab.
My code
import 'package:flutter/material.dart';
import 'package:imin_printer/imin_printer.dart';
import 'package:imin_printer/imin_style.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
// This widget is the root of your application.
@OverRide
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
theme: ThemeData(
colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
useMaterial3: true,
),
home: const MyHomePage(title: 'Print Imin'),
);
}
}
class MyHomePage extends StatefulWidget {
const MyHomePage({super.key, required this.title});
final String title;
@OverRide
State createState() => _MyHomePageState();
}
class _MyHomePageState extends State {
IminPrinter iminPrinter = IminPrinter();
@OverRide
void initState() {
// TODO: implement initState
super.initState();
initPrint();
}
Future initPrint() async {
// all method from imin printer need to async await
await iminPrinter.initPrinter().then((value) {
print('init ${value.toString()}');
}); // must init the printer first. for more exmaple.. pls refer to example tab.
}
Future printImin() async {
// await iminPrinter.printQrCode('https://www.imin.sg');
}
@OverRide
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
backgroundColor: Theme.of(context).colorScheme.inversePrimary,
title: Text(widget.title),
),
body: Center(
child:
ElevatedButton(onPressed: printImin, child: Text('Print IMIN'))),
);
}
}
Issues
I/flutter (11895): ┌───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
I/flutter (11895): │ #0 MethodChannelIminPrinter.getPrinterStatus (package:imin_printer/imin_printer_method_channel.dart:35:12)
I/flutter (11895): │ #1
I/flutter (11895): ├┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄
I/flutter (11895): │ 🐛 code -1
I/flutter (11895): └───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
I/flutter (11895): {code: -1, msg: Failed to initialize the printer!}
The text was updated successfully, but these errors were encountered: