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-17 13:39:07 +0100
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
3e4ab2d829b17ec7374a6884dd69156af016c194
3e4ab2d8
1 parent
a64bc9ae
add extra getters for Result
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
34 additions
and
0 deletions
lib/src/web/zxing/result.dart
lib/src/web/zxing/result.dart
View file @
3e4ab2d
import
'dart:js_interop'
;
import
'dart:typed_data'
;
import
'dart:ui'
;
import
'package:mobile_scanner/src/enums/barcode_format.dart'
;
import
'package:mobile_scanner/src/web/zxing/result_point.dart'
;
/// The JS static interop class for the Result class in the ZXing library.
///
...
...
@@ -74,4 +77,35 @@ extension ResultExt on Result {
return
BarcodeFormat
.
unknown
;
}
}
List
<
Offset
>
get
resultPoints
{
final
JSArray
?
resultPoints
=
getResultPoints
.
callAsFunction
()
as
JSArray
?;
if
(
resultPoints
==
null
)
{
return
[];
}
return
resultPoints
.
toDart
.
cast
<
ResultPoint
>().
map
((
point
)
{
return
Offset
(
point
.
x
,
point
.
y
);
}).
toList
();
}
/// Get the raw bytes of the result.
Uint8List
?
get
rawBytes
{
final
JSUint8Array
?
rawBytes
=
getRawBytes
.
callAsFunction
()
as
JSUint8Array
?;
return
rawBytes
?.
toDart
;
}
/// Get the text of the result.
String
?
get
text
{
return
getText
.
callAsFunction
()
as
String
?;
}
/// Get the timestamp of the result.
int
?
get
timestamp
{
final
JSNumber
?
timestamp
=
getTimestamp
.
callAsFunction
()
as
JSNumber
?;
return
timestamp
?.
toDartInt
;
}
}
...
...
Please
register
or
login
to post a comment