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