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:27:30 +0100
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
6b50ca9823fd1df016c71e76f0549232289a6239
6b50ca98
1 parent
87bd6bd2
update the result js interop definition
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
77 additions
and
0 deletions
lib/src/web/zxing/result.dart
lib/src/web/zxing/result.dart
0 → 100644
View file @
6b50ca9
import
'dart:js_interop'
;
import
'package:mobile_scanner/src/enums/barcode_format.dart'
;
/// The JS static interop class for the Result class in the ZXing library.
///
/// See also: https://github.com/zxing-js/library/blob/master/src/core/Result.ts
@JS
()
@staticInterop
abstract
class
Result
{}
extension
ResultExt
on
Result
{
/// Get the barcode format.
///
/// See also https://github.com/zxing-js/library/blob/master/src/core/BarcodeFormat.ts
external
JSFunction
getBarcodeFormat
;
/// Get the raw bytes of the result.
external
JSFunction
getRawBytes
;
/// Get the points of the result.
external
JSFunction
getResultPoints
;
/// Get the text of the result.
external
JSFunction
getText
;
/// Get the timestamp of the result.
external
JSFunction
getTimestamp
;
/// Get the barcode format of the result.
BarcodeFormat
get
barcodeFormat
{
final
JSNumber
?
format
=
getBarcodeFormat
.
callAsFunction
()
as
JSNumber
?;
switch
(
format
?.
toDartInt
)
{
case
0
:
return
BarcodeFormat
.
aztec
;
case
1
:
return
BarcodeFormat
.
codabar
;
case
2
:
return
BarcodeFormat
.
code39
;
case
3
:
return
BarcodeFormat
.
code93
;
case
4
:
return
BarcodeFormat
.
code128
;
case
5
:
return
BarcodeFormat
.
dataMatrix
;
case
6
:
return
BarcodeFormat
.
ean8
;
case
7
:
return
BarcodeFormat
.
ean13
;
case
8
:
return
BarcodeFormat
.
itf
;
case
9
:
// Maxicode
return
BarcodeFormat
.
unknown
;
case
10
:
return
BarcodeFormat
.
pdf417
;
case
11
:
return
BarcodeFormat
.
qrCode
;
case
12
:
// RSS 14
return
BarcodeFormat
.
unknown
;
case
13
:
// RSS EXPANDED
return
BarcodeFormat
.
unknown
;
case
14
:
return
BarcodeFormat
.
upcA
;
case
15
:
return
BarcodeFormat
.
upcE
;
case
16
:
// UPC/EAN extension
return
BarcodeFormat
.
unknown
;
default
:
return
BarcodeFormat
.
unknown
;
}
}
}
...
...
Please
register
or
login
to post a comment