Toggle navigation
Toggle navigation
This project
Loading...
Sign in
flutter_package
/
mobile_scanner
Go to a project
Toggle navigation
Projects
Groups
Snippets
Help
Toggle navigation pinning
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Authored by
Navaron Bracke
2023-11-03 17:23:30 +0100
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
8a50d72e1665c25abcc7f24fddaf2d346df90dca
8a50d72e
1 parent
c0390113
fix type of 'raw' attribute; remove width & height; update a comment
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
21 additions
and
22 deletions
CHANGELOG.md
lib/src/mobile_scanner_controller.dart
lib/src/objects/barcode.dart
lib/src/objects/barcode_capture.dart
CHANGELOG.md
View file @
8a50d72
## NEXT
BREAKING CHANGES:
*
The
`width` and `height` of `BarcodeCapture` have been removed, in favor of `size`
.
*
The
`raw` attribute is now `Object?` instead of `dynamic`
, so that it participates in type promotion.
## 4.0.1
Bugs fixed:
*
[
iOS
]
Fixed a crash with a nil capture session when starting the camera. (thanks @navaronbracke !)
...
...
lib/src/mobile_scanner_controller.dart
View file @
8a50d72
...
...
@@ -434,13 +434,18 @@ class MobileScannerController {
final
parsed
=
(
data
as
List
)
.
map
((
value
)
=>
Barcode
.
fromNative
(
value
as
Map
))
.
toList
();
final
double
?
width
=
event
[
'width'
]
as
double
?;
final
double
?
height
=
event
[
'height'
]
as
double
?;
_barcodesController
.
add
(
BarcodeCapture
(
raw:
data
,
barcodes:
parsed
,
image:
event
[
'image'
]
as
Uint8List
?,
width:
event
[
'width'
]
as
double
?,
height:
event
[
'height'
]
as
double
?,
size:
width
==
null
||
height
==
null
?
Size
.
zero
:
Size
(
width
,
height
),
),
);
case
'barcodeMac'
:
...
...
lib/src/objects/barcode.dart
View file @
8a50d72
...
...
@@ -147,7 +147,9 @@ class Barcode {
/// The SMS message that is embedded in the barcode.
final
SMS
?
sms
;
/// The type of the [format] of the barcode.
/// The contextual type of the [format] of the barcode.
///
/// For example: TYPE_TEXT, TYPE_PRODUCT, TYPE_URL, etc.
///
/// For types that are recognized,
/// but could not be parsed correctly, [BarcodeType.text] will be returned.
...
...
lib/src/objects/barcode_capture.dart
View file @
8a50d72
...
...
@@ -6,38 +6,25 @@ import 'package:mobile_scanner/src/objects/barcode.dart';
/// This class represents a scanned barcode.
class
BarcodeCapture
{
/// Create a new [BarcodeCapture] instance.
BarcodeCapture
({
const
BarcodeCapture
({
this
.
barcodes
=
const
<
Barcode
>[],
double
?
height
,
this
.
image
,
this
.
raw
,
double
?
width
,
})
:
size
=
width
==
null
&&
height
==
null
?
Size
.
zero
:
Size
(
width
!,
height
!);
this
.
size
=
Size
.
zero
,
});
/// The list of scanned barcodes.
final
List
<
Barcode
>
barcodes
;
/// The bytes of the image that is embedded in the barcode.
///
/// This null if [MobileScannerController.returnImage] is false.
/// This null if [MobileScannerController.returnImage] is false,
/// or if there is no available image.
final
Uint8List
?
image
;
/// The raw data of the scanned barcode.
final
dynamic
raw
;
// TODO: this should be `Object?` instead of dynamic
final
Object
?
raw
;
/// The size of the scanned barcode.
final
Size
size
;
/// The width of the scanned barcode.
///
/// Prefer using `size.width` instead,
/// as this getter will be removed in the future.
double
get
width
=>
size
.
width
;
/// The height of the scanned barcode.
///
/// Prefer using `size.height` instead,
/// as this getter will be removed in the future.
double
get
height
=>
size
.
height
;
}
...
...
Please
register
or
login
to post a comment