LogUploader constructor
- required void onLogStatusChangedCallback(
- GemError error,
- String logPath,
- LogUploaderState? status,
- int? progress,
Log uploader constructor
Parameters
- IN onLogStatusChangedCallback Callback to be called when the log status changes.
- IN error The error code of the upload
- IN logPath The path to the log file to upload
- IN status The status of the log upload
- IN progress The progress of the log upload
If the upload is successful, the error code will be GemError.success. It it will be different from GemError.success status and progress will be null.
Implementation
LogUploader({
required final void Function(
GemError error,
String logPath,
LogUploaderState? status,
int? progress,
)
onLogStatusChangedCallback,
}) {
_logUploadListener = LogUploadListener(
onLogStatusChangedCallback: (
final String logPath,
final int status,
final int progress,
) {
if (status < 0) {
onLogStatusChangedCallback(
GemErrorExtension.fromCode(status),
logPath,
null,
null,
);
}
onLogStatusChangedCallback(
GemError.success,
logPath,
LogUploaderStateExtension.fromId(status),
progress,
);
},
);
final String resultString = GemKitPlatform.instance.callCreateObject(
jsonEncode(<String, Object>{
'class': 'LogUploader',
'args': _logUploadListener.pointerId,
}),
);
final dynamic decodedVal = jsonDecode(resultString);
_pointerId = decodedVal['result'];
GemKitPlatform.instance.registerEventHandler(
_logUploadListener.pointerId,
_logUploadListener,
);
super.registerAutoReleaseObject(_pointerId);
}