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
2024-09-18 12:10:07 +0200
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
41382ee77935a8246aa8b89f07f165d5e8c5622d
41382ee7
1 parent
1ab7f5a7
parse code from platform exception; use shorter message; use if-case to extract size
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
11 deletions
lib/src/method_channel/mobile_scanner_method_channel.dart
lib/src/method_channel/mobile_scanner_method_channel.dart
View file @
41382ee
...
...
@@ -187,8 +187,7 @@ class MethodChannelMobileScanner extends MobileScannerPlatform {
throw
const
MobileScannerException
(
errorCode:
MobileScannerErrorCode
.
controllerAlreadyInitialized
,
errorDetails:
MobileScannerErrorDetails
(
message:
'The scanner was already started. Call stop() before calling start() again.'
,
message:
'The scanner was already started.'
,
),
);
}
...
...
@@ -204,7 +203,7 @@ class MethodChannelMobileScanner extends MobileScannerPlatform {
);
}
on
PlatformException
catch
(
error
)
{
throw
MobileScannerException
(
errorCode:
MobileScannerErrorCode
.
genericError
,
errorCode:
MobileScannerErrorCode
.
fromPlatformException
(
error
)
,
errorDetails:
MobileScannerErrorDetails
(
code:
error
.
code
,
details:
error
.
details
as
Object
?,
...
...
@@ -240,17 +239,13 @@ class MethodChannelMobileScanner extends MobileScannerPlatform {
startResult
[
'currentTorchState'
]
as
int
?
??
-
1
,
);
final
Map
<
Object
?,
Object
?>?
sizeInfo
=
startResult
[
'size'
]
as
Map
<
Object
?,
Object
?>?;
final
double
?
width
=
sizeInfo
?[
'width'
]
as
double
?;
final
double
?
height
=
sizeInfo
?[
'height'
]
as
double
?;
final
Size
size
;
if
(
width
==
null
||
height
==
null
)
{
size
=
Size
.
zero
;
}
else
{
if
(
startResult
[
'size'
]
case
{
'width'
:
final
double
width
,
'height'
:
final
double
height
})
{
size
=
Size
(
width
,
height
);
}
else
{
size
=
Size
.
zero
;
}
return
MobileScannerViewAttributes
(
...
...
Please
register
or
login
to post a comment