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
fdb16cd7
Unverified
Commit
fdb16cd7
authored
Apr 08, 2021
by
Jenn Magder
Committed by
GitHub
Apr 08, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Cast config values to dynamic values instead of Object (#80011)
parent
3e5f620a
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
10 additions
and
13 deletions
+10
-13
config.dart
packages/flutter_tools/lib/src/base/config.dart
+2
-2
file_store.dart
packages/flutter_tools/lib/src/build_system/file_store.dart
+3
-3
file_store_test.dart
...ools/test/general.shard/build_system/file_store_test.dart
+1
-3
config_test.dart
packages/flutter_tools/test/general.shard/config_test.dart
+4
-5
No files found.
packages/flutter_tools/lib/src/base/config.dart
View file @
fdb16cd7
...
@@ -62,7 +62,7 @@ class Config {
...
@@ -62,7 +62,7 @@ class Config {
}
}
try
{
try
{
ErrorHandlingFileSystem
.
noExitOnFailure
(()
{
ErrorHandlingFileSystem
.
noExitOnFailure
(()
{
_values
=
castStringKeyedMap
(
json
.
decode
(
_file
.
readAsStringSync
()))
as
Map
<
String
,
Object
>?
??
<
String
,
Object
>{};
_values
=
castStringKeyedMap
(
json
.
decode
(
_file
.
readAsStringSync
()))
??
<
String
,
Object
>{};
});
});
}
on
FormatException
{
}
on
FormatException
{
_logger
_logger
...
@@ -110,7 +110,7 @@ class Config {
...
@@ -110,7 +110,7 @@ class Config {
String
get
configPath
=>
_file
.
path
;
String
get
configPath
=>
_file
.
path
;
Map
<
String
,
Object
>
_values
=
<
String
,
Object
>{};
Map
<
String
,
dynamic
>
_values
=
<
String
,
Object
>{};
Iterable
<
String
>
get
keys
=>
_values
.
keys
;
Iterable
<
String
>
get
keys
=>
_values
.
keys
;
...
...
packages/flutter_tools/lib/src/build_system/file_store.dart
View file @
fdb16cd7
...
@@ -23,9 +23,9 @@ class FileStorage {
...
@@ -23,9 +23,9 @@ class FileStorage {
throw
Exception
(
'File storage format invalid'
);
throw
Exception
(
'File storage format invalid'
);
}
}
final
int
version
=
json
[
'version'
]
as
int
;
final
int
version
=
json
[
'version'
]
as
int
;
final
List
<
Map
<
String
,
Object
>>
rawCachedFiles
=
(
json
[
'files'
]
as
List
<
dynamic
>).
cast
<
Map
<
String
,
Object
>>();
final
List
<
Map
<
String
,
dynamic
>>
rawCachedFiles
=
(
json
[
'files'
]
as
List
<
dynamic
>).
cast
<
Map
<
String
,
dynamic
>>();
final
List
<
_FileHash
>
cachedFiles
=
<
_FileHash
>[
final
List
<
_FileHash
>
cachedFiles
=
<
_FileHash
>[
for
(
final
Map
<
String
,
Object
>
rawFile
in
rawCachedFiles
)
_FileHash
.
_fromJson
(
rawFile
),
for
(
final
Map
<
String
,
dynamic
>
rawFile
in
rawCachedFiles
)
_FileHash
.
_fromJson
(
rawFile
),
];
];
return
FileStorage
(
version
,
cachedFiles
);
return
FileStorage
(
version
,
cachedFiles
);
}
}
...
@@ -48,7 +48,7 @@ class FileStorage {
...
@@ -48,7 +48,7 @@ class FileStorage {
class
_FileHash
{
class
_FileHash
{
_FileHash
(
this
.
path
,
this
.
hash
);
_FileHash
(
this
.
path
,
this
.
hash
);
factory
_FileHash
.
_fromJson
(
Map
<
String
,
Object
>
json
)
{
factory
_FileHash
.
_fromJson
(
Map
<
String
,
dynamic
>
json
)
{
if
(!
json
.
containsKey
(
'path'
)
||
!
json
.
containsKey
(
'hash'
))
{
if
(!
json
.
containsKey
(
'path'
)
||
!
json
.
containsKey
(
'hash'
))
{
throw
Exception
(
'File storage format invalid'
);
throw
Exception
(
'File storage format invalid'
);
}
}
...
...
packages/flutter_tools/test/general.shard/build_system/file_store_test.dart
View file @
fdb16cd7
...
@@ -2,8 +2,6 @@
...
@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// found in the LICENSE file.
// @dart = 2.8
import
'dart:typed_data'
;
import
'dart:typed_data'
;
import
'package:file/memory.dart'
;
import
'package:file/memory.dart'
;
...
@@ -78,7 +76,7 @@ void main() {
...
@@ -78,7 +76,7 @@ void main() {
fileCache
.
initialize
();
fileCache
.
initialize
();
fileCache
.
diffFileList
(<
File
>[
file
]);
fileCache
.
diffFileList
(<
File
>[
file
]);
fileCache
.
persist
();
fileCache
.
persist
();
final
String
currentHash
=
fileCache
.
currentAssetKeys
[
file
.
path
];
final
String
?
currentHash
=
fileCache
.
currentAssetKeys
[
file
.
path
];
final
Uint8List
buffer
=
cacheFile
final
Uint8List
buffer
=
cacheFile
.
readAsBytesSync
();
.
readAsBytesSync
();
FileStorage
fileStorage
=
FileStorage
.
fromBuffer
(
buffer
);
FileStorage
fileStorage
=
FileStorage
.
fromBuffer
(
buffer
);
...
...
packages/flutter_tools/test/general.shard/config_test.dart
View file @
fdb16cd7
...
@@ -2,8 +2,6 @@
...
@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// found in the LICENSE file.
// @dart = 2.8
import
'package:file/memory.dart'
;
import
'package:file/memory.dart'
;
import
'package:flutter_tools/src/base/config.dart'
;
import
'package:flutter_tools/src/base/config.dart'
;
import
'package:flutter_tools/src/base/error_handling_io.dart'
;
import
'package:flutter_tools/src/base/error_handling_io.dart'
;
...
@@ -16,9 +14,9 @@ import 'package:test/fake.dart';
...
@@ -16,9 +14,9 @@ import 'package:test/fake.dart';
import
'../src/common.dart'
;
import
'../src/common.dart'
;
void
main
(
)
{
void
main
(
)
{
Config
config
;
late
Config
config
;
MemoryFileSystem
memoryFileSystem
;
late
MemoryFileSystem
memoryFileSystem
;
FakePlatform
fakePlatform
;
late
FakePlatform
fakePlatform
;
setUp
(()
{
setUp
(()
{
memoryFileSystem
=
MemoryFileSystem
.
test
();
memoryFileSystem
=
MemoryFileSystem
.
test
();
...
@@ -35,6 +33,7 @@ void main() {
...
@@ -35,6 +33,7 @@ void main() {
platform:
fakePlatform
,
platform:
fakePlatform
,
);
);
});
});
testWithoutContext
(
'Config get set value'
,
()
async
{
testWithoutContext
(
'Config get set value'
,
()
async
{
expect
(
config
.
getValue
(
'foo'
),
null
);
expect
(
config
.
getValue
(
'foo'
),
null
);
config
.
setValue
(
'foo'
,
'bar'
);
config
.
setValue
(
'foo'
,
'bar'
);
...
...
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