m8ty_client_docscan
Document scan client can be used to take documents like PDF, JPEG, PNG etc. and to send them to the server for QR code scan. If there are codes available those will be returned to the client.
Before you start
Check the documentation of the m8ty_client_docscan library to get an idea about the available models and their properties.
Import all needed libraries
import 'package:dio/dio.dart';
import 'package:m8ty_client_docscan/m8ty_client_docscan.dart';
import 'package:m8ty_client_common/m8ty_client_common.dart';
import 'package:built_collection/built_collection.dart';
Client Setup
final docscanClient = M8tyClientDocscan();
docscanClient.setApiKey(m8tyApiKeyAuth, "myApiKey");
API Surface
DocumentScanApi
Method | Description |
|---|---|
| Scan document for codes like QR codes |
How to perform different tasks
Here some examples how the dart client can be used
Scan some documents by using filter
final docscanClient = M8tyClientDocscan();
docscanClient.setApiKey(m8tyApiKeyAuth, "myApiKey");
final DocumentScanApi documentScanApi = docscanClient.getDocumentScanApi();
// Create MultipartFile documents
final file1 = MultipartFile.fromFile(
'path/to/your/file1.jpg',
filename: 'file1.jpg',
);
final file2 = MultipartFile.fromFile(
'path/to/your/file2.pdf',
filename: 'file2.pdf',
);
// Add the files to a BuiltList
final documents = BuiltList<MultipartFile>([file1, file2]);
// Specify the types (optional)
final types = BuiltList<CodeTypeModel>([
CodeTypeModel.qrcode,
]);
try {
final Response<ScanCodeResponseModel> scanResponse = await documentScanApi.scanForCodes(
documents: documents,
types: types,
filter: "^SPC[\\s\\S]*\$",
);
print('Scanned codes: ${scanResponse.data}');
} on DioException catch (e) {
throw Exception(
'Request failed (status: ${e.response?.statusCode}): ${e.response?.data}',
);
}
03 June 2026