Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
F
Front-End
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
abdullh.alsoleman
Front-End
Commits
26d1da41
Unverified
Commit
26d1da41
authored
Feb 04, 2022
by
Lau Ching Jun
Committed by
GitHub
Feb 04, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix error in type cast. (#97778)
parent
1fcb076e
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
1 deletion
+26
-1
device.dart
packages/flutter_tools/lib/src/device.dart
+1
-1
device_test.dart
packages/flutter_tools/test/general.shard/device_test.dart
+25
-0
No files found.
packages/flutter_tools/lib/src/device.dart
View file @
26d1da41
...
...
@@ -980,7 +980,7 @@ class DebuggingOptions {
debuggingEnabled:
(
json
[
'debuggingEnabled'
]
as
bool
?)!,
startPaused:
(
json
[
'startPaused'
]
as
bool
?)!,
dartFlags:
(
json
[
'dartFlags'
]
as
String
?)!,
dartEntrypointArgs:
((
json
[
'dartEntrypointArgs'
]
as
List
<
String
>?)?.
cast
<
String
>())!,
dartEntrypointArgs:
((
json
[
'dartEntrypointArgs'
]
as
List
<
dynamic
>?)?.
cast
<
String
>())!,
disableServiceAuthCodes:
(
json
[
'disableServiceAuthCodes'
]
as
bool
?)!,
enableDds:
(
json
[
'enableDds'
]
as
bool
?)!,
enableSoftwareRendering:
(
json
[
'enableSoftwareRendering'
]
as
bool
?)!,
...
...
packages/flutter_tools/test/general.shard/device_test.dart
View file @
26d1da41
...
...
@@ -9,7 +9,9 @@ import 'package:flutter_tools/src/base/io.dart';
import
'package:flutter_tools/src/base/logger.dart'
;
import
'package:flutter_tools/src/base/terminal.dart'
;
import
'package:flutter_tools/src/base/user_messages.dart'
;
import
'package:flutter_tools/src/base/utils.dart'
;
import
'package:flutter_tools/src/build_info.dart'
;
import
'package:flutter_tools/src/convert.dart'
;
import
'package:flutter_tools/src/device.dart'
;
import
'package:flutter_tools/src/project.dart'
;
import
'package:test/fake.dart'
;
...
...
@@ -508,6 +510,29 @@ void main() {
expect
(
computeDartVmFlags
(
DebuggingOptions
.
enabled
(
BuildInfo
.
debug
,
nullAssertions:
true
)),
'--null_assertions'
);
expect
(
computeDartVmFlags
(
DebuggingOptions
.
enabled
(
BuildInfo
.
debug
,
dartFlags:
'--foo'
,
nullAssertions:
true
)),
'--foo,--null_assertions'
);
});
group
(
'JSON encode DebuggingOptions'
,
()
{
testWithoutContext
(
'can preserve the original options'
,
()
{
final
DebuggingOptions
original
=
DebuggingOptions
.
enabled
(
BuildInfo
.
debug
,
startPaused:
true
,
disableServiceAuthCodes:
true
,
enableDds:
false
,
dartEntrypointArgs:
<
String
>[
'a'
,
'b'
],
dartFlags:
'c'
,
deviceVmServicePort:
1234
,
);
final
String
jsonString
=
json
.
encode
(
original
.
toJson
());
final
Map
<
String
,
dynamic
>
decoded
=
castStringKeyedMap
(
json
.
decode
(
jsonString
))!;
final
DebuggingOptions
deserialized
=
DebuggingOptions
.
fromJson
(
decoded
,
BuildInfo
.
debug
);
expect
(
deserialized
.
startPaused
,
original
.
startPaused
);
expect
(
deserialized
.
disableServiceAuthCodes
,
original
.
disableServiceAuthCodes
);
expect
(
deserialized
.
enableDds
,
original
.
enableDds
);
expect
(
deserialized
.
dartEntrypointArgs
,
original
.
dartEntrypointArgs
);
expect
(
deserialized
.
dartFlags
,
original
.
dartFlags
);
expect
(
deserialized
.
deviceVmServicePort
,
original
.
deviceVmServicePort
);
});
});
}
class
TestDeviceManager
extends
DeviceManager
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment