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
428cafad
Unverified
Commit
428cafad
authored
Aug 26, 2022
by
Jonah Williams
Committed by
GitHub
Aug 26, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[flutter_tools] migrate some files to null safety (#110354)
parent
8a40c7de
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
50 additions
and
52 deletions
+50
-52
drive.dart
packages/flutter_tools/lib/src/commands/drive.dart
+0
-2
drive_service.dart
packages/flutter_tools/lib/src/drive/drive_service.dart
+2
-2
resident_runner.dart
packages/flutter_tools/lib/src/resident_runner.dart
+1
-1
sksl_writer.dart
packages/flutter_tools/lib/src/sksl_writer.dart
+2
-2
flutter_web_goldens.dart
packages/flutter_tools/lib/src/test/flutter_web_goldens.dart
+7
-3
drive_service_test.dart
...er_tools/test/general.shard/drive/drive_service_test.dart
+30
-32
golden_comparator_test.dart
..._tools/test/general.shard/web/golden_comparator_test.dart
+8
-10
No files found.
packages/flutter_tools/lib/src/commands/drive.dart
View file @
428cafad
...
...
@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import
'dart:async'
;
import
'package:meta/meta.dart'
;
...
...
packages/flutter_tools/lib/src/drive/drive_service.dart
View file @
428cafad
...
...
@@ -290,9 +290,9 @@ class FlutterDriverService extends DriverService {
})
async
{
if
(
writeSkslOnExit
!=
null
)
{
final
FlutterView
flutterView
=
(
await
_vmService
.
getFlutterViews
()).
first
;
final
Map
<
String
,
Object
>
result
=
await
(
_vmService
.
getSkSLs
(
final
Map
<
String
,
Object
?>?
result
=
await
_vmService
.
getSkSLs
(
viewId:
flutterView
.
id
)
as
FutureOr
<
Map
<
String
,
Object
>>)
;
);
await
sharedSkSlWriter
(
_device
!,
result
,
outputFile:
writeSkslOnExit
,
logger:
_logger
);
}
// If the application package is available, stop and uninstall.
...
...
packages/flutter_tools/lib/src/resident_runner.dart
View file @
428cafad
...
...
@@ -934,7 +934,7 @@ abstract class ResidentHandlers {
viewId:
views
.
first
.
id
,
);
final
Device
device
=
flutterDevice
.
device
!;
return
sharedSkSlWriter
(
device
,
data
!
);
return
sharedSkSlWriter
(
device
,
data
);
}
/// Take a screenshot on the provided [device].
...
...
packages/flutter_tools/lib/src/sksl_writer.dart
View file @
428cafad
...
...
@@ -13,12 +13,12 @@ import 'convert.dart';
import
'device.dart'
;
import
'globals.dart'
as
globals
;
Future
<
String
?>
sharedSkSlWriter
(
Device
device
,
Map
<
String
,
Object
?>
data
,
{
Future
<
String
?>
sharedSkSlWriter
(
Device
device
,
Map
<
String
,
Object
?>
?
data
,
{
File
?
outputFile
,
Logger
?
logger
,
})
async
{
logger
??=
globals
.
logger
;
if
(
data
.
isEmpty
)
{
if
(
data
==
null
||
data
.
isEmpty
)
{
logger
.
printStatus
(
'No data was received. To ensure SkSL data can be generated use a '
'physical device then:
\n
'
...
...
packages/flutter_tools/lib/src/test/flutter_web_goldens.dart
View file @
428cafad
...
...
@@ -56,7 +56,7 @@ class TestGoldenComparator {
/// to reduce the overhead of starting `flutter_tester`.
Future
<
TestGoldenComparatorProcess
?>
_processForTestFile
(
Uri
testUri
)
async
{
if
(
testUri
==
_previousTestUri
)
{
return
_previousComparator
;
return
_previousComparator
!
;
}
final
String
bootstrap
=
TestGoldenComparatorProcess
.
generateBootstrap
(
_fileSystem
.
file
(
testUri
),
testUri
,
logger:
_logger
);
...
...
@@ -68,7 +68,7 @@ class TestGoldenComparator {
_previousComparator
=
TestGoldenComparatorProcess
(
process
,
logger:
_logger
);
_previousTestUri
=
testUri
;
return
_previousComparator
;
return
_previousComparator
!
;
}
Future
<
Process
?>
_startProcess
(
String
testBootstrap
)
async
{
...
...
@@ -100,7 +100,11 @@ class TestGoldenComparator {
Future
<
String
?>
compareGoldens
(
Uri
testUri
,
Uint8List
bytes
,
Uri
goldenKey
,
bool
?
updateGoldens
)
async
{
final
File
imageFile
=
await
(
await
tempDir
.
createTemp
(
'image'
)).
childFile
(
'image'
).
writeAsBytes
(
bytes
);
final
TestGoldenComparatorProcess
process
=
await
(
_processForTestFile
(
testUri
)
as
FutureOr
<
TestGoldenComparatorProcess
>);
final
TestGoldenComparatorProcess
?
process
=
await
_processForTestFile
(
testUri
);
if
(
process
==
null
)
{
return
'process was null'
;
}
process
.
sendCommand
(
imageFile
,
goldenKey
,
updateGoldens
);
final
Map
<
String
,
dynamic
>
result
=
await
process
.
getResponse
();
...
...
packages/flutter_tools/test/general.shard/drive/drive_service_test.dart
View file @
428cafad
...
...
@@ -2,14 +2,13 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// @dart = 2.8
import
'dart:async'
;
import
'package:file/file.dart'
;
import
'package:file/memory.dart'
;
import
'package:flutter_tools/src/application_package.dart'
;
import
'package:flutter_tools/src/base/dds.dart'
;
import
'package:flutter_tools/src/base/io.dart'
as
io
;
import
'package:flutter_tools/src/base/logger.dart'
;
import
'package:flutter_tools/src/base/process.dart'
;
import
'package:flutter_tools/src/build_info.dart'
;
...
...
@@ -19,7 +18,6 @@ import 'package:flutter_tools/src/drive/drive_service.dart';
import
'package:flutter_tools/src/resident_runner.dart'
;
import
'package:flutter_tools/src/version.dart'
;
import
'package:flutter_tools/src/vmservice.dart'
;
import
'package:meta/meta.dart'
;
import
'package:package_config/package_config_types.dart'
;
import
'package:test/fake.dart'
;
import
'package:vm_service/vm_service.dart'
as
vm_service
;
...
...
@@ -425,10 +423,10 @@ void main() {
}
FlutterDriverService
setUpDriverService
(
{
Logger
logger
,
ProcessManager
processManager
,
FlutterVmService
vmService
,
DevtoolsLauncher
devtoolsLauncher
,
Logger
?
logger
,
ProcessManager
?
processManager
,
FlutterVmService
?
vmService
,
DevtoolsLauncher
?
devtoolsLauncher
,
})
{
logger
??=
BufferLogger
.
test
();
return
FlutterDriverService
(
...
...
@@ -441,14 +439,14 @@ FlutterDriverService setUpDriverService({
dartSdkPath:
'dart'
,
devtoolsLauncher:
devtoolsLauncher
??
FakeDevtoolsLauncher
(),
vmServiceConnector:
(
Uri
httpUri
,
{
ReloadSources
reloadSources
,
Restart
restart
,
CompileExpression
compileExpression
,
GetSkSLMethod
getSkSLMethod
,
PrintStructuredErrorLogMethod
printStructuredErrorLogMethod
,
Object
compression
,
Device
device
,
@
required
Logger
logger
,
ReloadSources
?
reloadSources
,
Restart
?
restart
,
CompileExpression
?
compileExpression
,
GetSkSLMethod
?
getSkSLMethod
,
PrintStructuredErrorLogMethod
?
printStructuredErrorLogMethod
,
io
.
CompressionOptions
compression
=
io
.
CompressionOptions
.
compressionDefault
,
Device
?
device
,
required
Logger
logger
,
})
async
{
assert
(
logger
!=
null
);
if
(
httpUri
.
scheme
!=
'http'
)
{
...
...
@@ -457,7 +455,7 @@ FlutterDriverService setUpDriverService({
if
(
httpUri
.
path
.
endsWith
(
'/ws'
))
{
fail
(
'Expected HTTP uri to not contain `/ws`, found
$httpUri
'
);
}
return
vmService
;
return
vmService
!
;
}
);
}
...
...
@@ -470,8 +468,8 @@ class FakeApplicationPackageFactory extends Fake implements ApplicationPackageFa
@override
Future
<
ApplicationPackage
>
getPackageForPlatform
(
TargetPlatform
platform
,
{
BuildInfo
buildInfo
,
File
applicationBinary
,
BuildInfo
?
buildInfo
,
File
?
applicationBinary
,
})
async
=>
applicationPackage
;
}
...
...
@@ -505,20 +503,20 @@ class FakeDevice extends Fake implements Device {
@override
Future
<
DeviceLogReader
>
getLogReader
({
covariant
ApplicationPackage
app
,
covariant
ApplicationPackage
?
app
,
bool
includePastLogs
=
false
,
})
async
=>
NoOpDeviceLogReader
(
'test'
);
@override
Future
<
LaunchResult
>
startApp
(
covariant
ApplicationPackage
package
,
{
String
mainPath
,
String
route
,
DebuggingOptions
debuggingOptions
,
Map
<
String
,
dynamic
>
platformArgs
,
String
?
mainPath
,
String
?
route
,
required
DebuggingOptions
debuggingOptions
,
Map
<
String
,
Object
?>
platformArgs
=
const
<
String
,
Object
?>{}
,
bool
prebuiltApplication
=
false
,
bool
ipv6
=
false
,
String
userIdentifier
,
String
?
userIdentifier
,
})
async
{
if
(
failOnce
)
{
failOnce
=
false
;
...
...
@@ -528,13 +526,13 @@ class FakeDevice extends Fake implements Device {
}
@override
Future
<
bool
>
stopApp
(
covariant
ApplicationPackage
app
,
{
String
userIdentifier
})
async
{
Future
<
bool
>
stopApp
(
covariant
ApplicationPackage
app
,
{
String
?
userIdentifier
})
async
{
didStopApp
=
true
;
return
true
;
}
@override
Future
<
bool
>
uninstallApp
(
covariant
ApplicationPackage
app
,
{
String
userIdentifier
})
async
{
Future
<
bool
>
uninstallApp
(
covariant
ApplicationPackage
app
,
{
String
?
userIdentifier
})
async
{
didUninstallApp
=
true
;
return
true
;
}
...
...
@@ -555,10 +553,10 @@ class FakeDartDevelopmentService extends Fake implements DartDevelopmentService
@override
Future
<
void
>
startDartDevelopmentService
(
Uri
observatoryUri
,
{
@
required
Logger
logger
,
int
hostPort
,
bool
ipv6
,
bool
disableServiceAuthCodes
,
required
Logger
logger
,
int
?
hostPort
,
bool
?
ipv6
,
bool
?
disableServiceAuthCodes
,
bool
cacheStartupProfile
=
false
,
})
async
{
started
=
true
;
...
...
@@ -575,7 +573,7 @@ class FakeDevtoolsLauncher extends Fake implements DevtoolsLauncher {
final
Completer
<
void
>
_processStarted
=
Completer
<
void
>();
@override
Future
<
void
>
launch
(
Uri
vmServiceUri
,
{
List
<
String
>
additionalArguments
})
{
Future
<
void
>
launch
(
Uri
vmServiceUri
,
{
List
<
String
>
?
additionalArguments
})
{
_processStarted
.
complete
();
return
Completer
<
void
>().
future
;
}
...
...
packages/flutter_tools/test/general.shard/web/golden_comparator_test.dart
View file @
428cafad
...
...
@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// @dart = 2.8
import
'dart:async'
;
import
'dart:convert'
;
import
'dart:typed_data'
;
...
...
@@ -28,7 +26,7 @@ final Uint8List imageBytes = Uint8List.fromList(<int>[1, 2, 3, 4, 5]);
void
main
(
)
{
group
(
'Test that TestGoldenComparator'
,
()
{
FakeProcessManager
processManager
;
late
FakeProcessManager
processManager
;
setUp
(()
{
processManager
=
FakeProcessManager
.
empty
();
...
...
@@ -63,7 +61,7 @@ void main() {
webRenderer:
WebRendererMode
.
html
,
);
final
String
result
=
await
comparator
.
compareGoldens
(
testUri
,
imageBytes
,
goldenKey
,
false
);
final
String
?
result
=
await
comparator
.
compareGoldens
(
testUri
,
imageBytes
,
goldenKey
,
false
);
expect
(
result
,
null
);
});
...
...
@@ -92,7 +90,7 @@ void main() {
webRenderer:
WebRendererMode
.
canvaskit
,
);
final
String
result
=
await
comparator
.
compareGoldens
(
testUri
,
imageBytes
,
goldenKey
,
false
);
final
String
?
result
=
await
comparator
.
compareGoldens
(
testUri
,
imageBytes
,
goldenKey
,
false
);
expect
(
result
,
'some message'
);
});
...
...
@@ -125,10 +123,10 @@ void main() {
webRenderer:
WebRendererMode
.
html
,
);
final
String
result1
=
await
comparator
.
compareGoldens
(
testUri
,
imageBytes
,
goldenKey
,
false
);
final
String
?
result1
=
await
comparator
.
compareGoldens
(
testUri
,
imageBytes
,
goldenKey
,
false
);
expect
(
result1
,
'some message'
);
final
String
result2
=
await
comparator
.
compareGoldens
(
testUri
,
imageBytes
,
goldenKey2
,
false
);
final
String
?
result2
=
await
comparator
.
compareGoldens
(
testUri
,
imageBytes
,
goldenKey2
,
false
);
expect
(
result2
,
'some other message'
);
});
...
...
@@ -170,10 +168,10 @@ void main() {
webRenderer:
WebRendererMode
.
canvaskit
,
);
final
String
result1
=
await
comparator
.
compareGoldens
(
testUri
,
imageBytes
,
goldenKey
,
false
);
final
String
?
result1
=
await
comparator
.
compareGoldens
(
testUri
,
imageBytes
,
goldenKey
,
false
);
expect
(
result1
,
'some message'
);
final
String
result2
=
await
comparator
.
compareGoldens
(
testUri2
,
imageBytes
,
goldenKey2
,
false
);
final
String
?
result2
=
await
comparator
.
compareGoldens
(
testUri2
,
imageBytes
,
goldenKey2
,
false
);
expect
(
result2
,
'some other message'
);
});
...
...
@@ -205,7 +203,7 @@ void main() {
webRenderer:
WebRendererMode
.
html
,
);
final
String
result
=
await
comparator
.
compareGoldens
(
testUri
,
imageBytes
,
goldenKey
,
false
);
final
String
?
result
=
await
comparator
.
compareGoldens
(
testUri
,
imageBytes
,
goldenKey
,
false
);
expect
(
result
,
null
);
await
comparator
.
close
();
...
...
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