firstly I hit the button to execute openPort and it works successfully,
then I hit the button to execute setPort and it works successfully,
then when I hit the button to run printText the app crashes and it doesn't give any errors
I got no idea why it doesn't work
int openPort(String text) {
var openPrn = AppManager.helloLib.lookupFunction<
ffi.Int Function(ffi.Pointer<Utf8>),
int Function(Pointer<Utf8>)>('Port_OpenUSBIO');
var result = openPrn(text.toNativeUtf8());
return result;
}
bool setPort(int num) {
var setPortt = AppManager.helloLib
.lookupFunction<ffi.Bool Function(ffi.Int32), bool Function(int)>(
'Port_SetPort');
var result = setPortt(num);
return result;
}
bool printText(String text, int nLan, int nOrgx, int nWidthTimes,
int nHeightTimes, int fontType, int nFontStyle) {
Uint16List data = Uint16List.fromList(text.codeUnits);
print(data);
final dataBtr = calloc<Uint16>(data.length);
dataBtr.asTypedList(data.length).setAll(0, data);
print(dataBtr);
// return true;
var printTextt = AppManager.helloLib.lookupFunction<
ffi.Bool Function(
ffi.Pointer<Uint16>,
ffi.Int,
ffi.Int,
ffi.Int,
ffi.Int,
ffi.Int,
ffi.Int,
),
bool Function(
Pointer<Uint16>, int, int, int, int, int, int)>('Pos_Text');
var result = printTextt(
dataBtr,
nLan,
nOrgx,
nWidthTimes,
nHeightTimes,
fontType,
nFontStyle,
);
print(result);
return result;
}