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
Let's tackle the first and main component, the `ScannerPage` class which will be implemented in `scan_page.dart`. In order to implement the full driver license scanner workflow, the following needs to be done in order:
84
84
@@ -188,16 +188,134 @@ class _ScannerPageState extends State<ScannerPage> with RouteAware {
188
188
>- The license string here grants a time-limited free trial which requires network connection to work.
189
189
>- You can request a 30-day trial license via the [Trial License](https://www.dynamsoft.com/customer/license/trialLicense?product=dbr&utm_source=guide&package=mobile) portal.
190
190
191
-
### Implementing the DriverLicenseScanResult Class
191
+
### Define the Result Classes and Related APIs
192
192
193
-
The next step in building this app is to create the `DriverLicenseScanResult` class which will be used to represent the parsed information that is output by the library. **For the full implementation of this class, please refer to [*driver_license_scan_result.dart*]([ScanDriversLicense/lib/driver_license_scan_result.dart](https://github.com/Dynamsoft/barcode-reader-flutter-samples/blob/main/ScanDriversLicense/lib/driver_license_scan_result.dart))**. Here is a quick breakdown of the `DriverLicenseScanResult` class:
193
+
The next step in building this app is to create the `DriverLicenseScanResult` class which will be used to represent the parsed information that is output by the library. **For the full implementation of this class, please refer to [*driver_license_scan_result.dart*](https://github.com/Dynamsoft/barcode-reader-flutter-samples/blob/main/ScanDriversLicense/lib/driver_license_scan_result.dart). Here is a quick breakdown of the `DriverLicenseScanResult` class:
194
194
195
195
-`resultStatus` represents whether the result was produced successfully, if the scan operation was cancelled, or if an error occurred during the scanning process.
196
196
-`data` is a `DriverLicenseData` object that represents the parsed information as different string fields which can then be accessed via these key fields and presented to the user in a friendly manner.
197
197
-`DriverLicenseData` is created from a [`ParsedResultItem`]({{ site.dcp_flutter_api }}parsed-result-item.html) object via the `fromParsedResultItem()` function that is defined in the `DriverLicenseData` class.
198
198
-`errorString` is the error message that is produced should the `resultStatus` be `exception`.
Now that the main Scanner widget and the `DriverLicenseScanResult` class are implemented, it's time to bring them together in the *main.dart* of the project. For the full implementation of *main.dart*, please see the code below:
203
321
@@ -323,19 +441,6 @@ If everything is set up correctly, you should see the app running on your device
323
441
324
442
### Android
325
443
326
-
#### Camera Permissions
327
-
328
-
On Android, permission to use the camera must be set in the code as such:
329
-
330
-
```dart
331
-
PermissionUtil.requestCameraPermission();
332
-
```
333
-
334
-
> [!NOTE]
335
-
> This is done via the [`PermissionUtil`]({{ site.dcv_flutter_api }}utility/permission-util.html) class. Please note that the code snippets in the previous sections contain this line in order to make the app run successfully.
336
-
337
-
#### Deploying to Device
338
-
339
444
Go to the project folder, open a new terminal and run the following command:
340
445
341
446
```bash
@@ -344,12 +449,6 @@ flutter run -d <DEVICE_ID>
344
449
345
450
You can get the IDs of all connected (physical) devices by running the command `flutter devices`.
346
451
347
-
#### iOS
348
-
349
-
In order to deploy the app to a iOS device, we recommend doing it via Xcode by using the `Runner.xcworkspace` project that was generated when the pods were installed. Since the camera permissions are taken care of, all you need to do is properly configure the *Signing & Capabilities* section of the project settings. Should the iOS device be connected to the computer, you can now run and deploy the app to the device.
350
-
351
-
If everything is set up correctly, you should see the app running on your device.
352
-
353
452
## Full Sample Code
354
453
355
454
The full sample code is available [here](https://github.com/Dynamsoft/barcode-reader-flutter-samples/tree/main/ScanDriversLicense).
@@ -360,4 +459,4 @@ You can request a 30-day trial license via the [Trial License](https://www.dynam
The format of the barcode. One of the [`EnumBarcodeFormat`]({{ site.dcv_react_native_api }}core/enum/barcode-format.html).
46
46
47
-
```js
47
+
```tsx
48
48
format: EnumBarcodeFormat|bigint;
49
49
```
50
50
51
51
### formatString
52
52
53
53
The format of the barcode as a text string instead of a `EnumBarcodeFormat`.
54
54
55
-
```js
55
+
```tsx
56
56
formatString: string;
57
57
```
58
58
59
59
### text
60
60
61
61
The decoded text of the barcode.
62
62
63
-
```js
63
+
```tsx
64
64
text: string;
65
65
```
66
66
67
67
### location
68
68
69
69
The location of the barcode in the image/frame as a [`Quadrilateral`]({{ site.dcv_react_native_api }}core/quadrilateral.html). The quadrilateral contains the four vertex points of the location, with the first vertex being the left-most vertex, then going in a clockwise direction for the remaining points.
70
70
71
-
```js
71
+
```tsx
72
72
location: Quadrilateral;
73
73
```
74
74
75
75
### confidence
76
76
77
77
The confidence of the barcode result is a measure of the result's accuracy. If the confidence is lower than 30, the result will not be output by default as it is considered quite inaccurate.
78
78
79
-
```js
79
+
```tsx
80
80
confidence: number;
81
81
```
82
82
83
83
### angle
84
84
85
85
The angle at which the barcode is detected if it's not aligned in the image/frame.
86
86
87
-
```js
87
+
```tsx
88
88
angle: number;
89
89
```
90
90
91
91
### moduleSize
92
92
93
93
The size of the smallest module (dot or line) of the barcode.
94
94
95
-
```js
95
+
```tsx
96
96
moduleSize: number;
97
97
```
98
98
99
99
### isDPM
100
100
101
101
Indicates whether the barcode is a Dot Peen Marking (DPM), which is a unique type of DataMatrix code.
102
102
103
-
```js
103
+
```tsx
104
104
isDPM: boolean;
105
105
```
106
106
107
107
### isMirrored
108
108
109
109
Indicates whether the barcode image is mirrored.
110
110
111
-
```js
111
+
```tsx
112
112
isMirrored: boolean;
113
113
```
114
114
115
115
### qrCodeDetails
116
116
117
117
Represents extended info (as [`QRCodeDetails`](qr-code-details.md)) that is specific to QR Codes, if the decoded barcode is a QR Code.
118
118
119
-
```js
119
+
```tsx
120
120
qrCodeDetails?:QRCodeDetails;
121
121
```
122
122
123
123
### aztecDetails
124
124
125
125
Represents extended info (as [`AztecDetails`](aztec-details.md)) that is specific to Aztec codes, if the decoded barcode is an Aztec code.
126
126
127
-
```js
127
+
```tsx
128
128
aztecDetails?:AztecDetails;
129
129
```
130
130
131
131
### dataMatrixDetails
132
132
133
133
Represents extended info (as [`DataMatrixDetails`](datamatrix-details.md)) that is specific to DataMatrix codes, if the decoded barcode is a DataMatrix code.
134
134
135
-
```js
135
+
```tsx
136
136
dataMatrixDetails?:DataMatrixDetails;
137
137
```
138
138
139
139
### oneDCodeDetails
140
140
141
141
Represents extended info (as [`OneDCodeDetails`](oned-details.md)) that is specific to 1D codes, if the decoded barcode is a 1D code.
142
142
143
-
```js
143
+
```tsx
144
144
oneDCodeDetails?:OneDCodeDetails;
145
145
```
146
146
147
147
### pdf417Details
148
148
149
149
Represents extended info (as [`PDF417Details`](pdf417-details.md)) that is specific to PDF417 codes, if the decoded barcode is a PDF417 code.
0 commit comments