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
06f051b2
Unverified
Commit
06f051b2
authored
Jan 28, 2021
by
Michael Goderbauer
Committed by
GitHub
Jan 28, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Migrate remaining examples to null-safety (#74857)
parent
c505ee79
Changes
14
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
37 additions
and
32 deletions
+37
-32
test.dart
dev/bots/test.dart
+1
-1
main.dart
examples/flutter_view/lib/main.dart
+3
-4
pubspec.yaml
examples/flutter_view/pubspec.yaml
+1
-1
main.dart
examples/image_list/lib/main.dart
+14
-14
pubspec.yaml
examples/image_list/pubspec.yaml
+1
-1
main.dart
examples/platform_channel/lib/main.dart
+2
-2
pubspec.yaml
examples/platform_channel/pubspec.yaml
+1
-1
button_tap_test.dart
examples/platform_channel/test_driver/button_tap_test.dart
+3
-0
main.dart
examples/platform_channel_swift/lib/main.dart
+2
-2
pubspec.yaml
examples/platform_channel_swift/pubspec.yaml
+1
-1
button_tap_test.dart
...s/platform_channel_swift/test_driver/button_tap_test.dart
+3
-0
main.dart
examples/platform_view/lib/main.dart
+3
-3
pubspec.yaml
examples/platform_view/pubspec.yaml
+1
-1
pubspec.yaml
examples/splash/pubspec.yaml
+1
-1
No files found.
dev/bots/test.dart
View file @
06f051b2
...
...
@@ -666,7 +666,7 @@ Future<void> _runFrameworkTests() async {
await
_runFlutterTest
(
path
.
join
(
flutterRoot
,
'dev'
,
'integration_tests'
,
'android_semantics_testing'
));
await
_runFlutterTest
(
path
.
join
(
flutterRoot
,
'dev'
,
'manual_tests'
));
await
_runFlutterTest
(
path
.
join
(
flutterRoot
,
'dev'
,
'tools'
,
'vitool'
));
await
_runFlutterTest
(
path
.
join
(
flutterRoot
,
'examples'
,
'hello_world'
));
await
_runFlutterTest
(
path
.
join
(
flutterRoot
,
'examples'
,
'hello_world'
)
,
options:
soundNullSafetyOptions
);
await
_runFlutterTest
(
path
.
join
(
flutterRoot
,
'examples'
,
'layers'
),
options:
soundNullSafetyOptions
);
await
_runFlutterTest
(
path
.
join
(
flutterRoot
,
'dev'
,
'benchmarks'
,
'test_apps'
,
'stocks'
));
await
_runFlutterTest
(
path
.
join
(
flutterRoot
,
'packages'
,
'flutter_driver'
),
tests:
<
String
>[
path
.
join
(
'test'
,
'src'
,
'real_tests'
)]);
...
...
examples/flutter_view/lib/main.dart
View file @
06f051b2
...
...
@@ -11,7 +11,6 @@ void main() {
}
class
FlutterView
extends
StatelessWidget
{
@override
Widget
build
(
BuildContext
context
)
{
return
MaterialApp
(
...
...
@@ -33,8 +32,8 @@ class _MyHomePageState extends State<MyHomePage> {
static
const
String
_channel
=
'increment'
;
static
const
String
_pong
=
'pong'
;
static
const
String
_emptyMessage
=
''
;
static
const
BasicMessageChannel
<
String
>
platform
=
BasicMessageChannel
<
String
>(
_channel
,
StringCodec
());
static
const
BasicMessageChannel
<
String
?
>
platform
=
BasicMessageChannel
<
String
?
>(
_channel
,
StringCodec
());
int
_counter
=
0
;
...
...
@@ -44,7 +43,7 @@ class _MyHomePageState extends State<MyHomePage> {
platform
.
setMessageHandler
(
_handlePlatformIncrement
);
}
Future
<
String
>
_handlePlatformIncrement
(
String
message
)
async
{
Future
<
String
>
_handlePlatformIncrement
(
String
?
message
)
async
{
setState
(()
{
_counter
++;
});
...
...
examples/flutter_view/pubspec.yaml
View file @
06f051b2
...
...
@@ -2,7 +2,7 @@ name: flutter_view
description
:
A new flutter project.
environment
:
sdk
:
"
>=2.
0.0-dev.68.
0
<3.0.0"
sdk
:
"
>=2.
12.0-
0
<3.0.0"
dependencies
:
flutter
:
...
...
examples/image_list/lib/main.dart
View file @
06f051b2
...
...
@@ -81,7 +81,7 @@ mhBKvYQc85gja0s1c+1VXA==
class
MyHttpOverrides
extends
HttpOverrides
{
@override
HttpClient
createHttpClient
(
SecurityContext
context
)
{
HttpClient
createHttpClient
(
SecurityContext
?
context
)
{
return
super
.
createHttpClient
(
(
context
??
SecurityContext
())..
setTrustedCertificatesBytes
(
certificate
.
codeUnits
)
);
...
...
@@ -141,7 +141,7 @@ class MyApp extends StatelessWidget {
}
class
MyHomePage
extends
StatefulWidget
{
const
MyHomePage
({
Key
key
,
this
.
title
,
this
.
port
})
:
super
(
key:
key
);
const
MyHomePage
({
Key
?
key
,
required
this
.
title
,
required
this
.
port
})
:
super
(
key:
key
);
final
String
title
;
final
int
port
;
...
...
@@ -164,7 +164,7 @@ class _MyHomePageState extends State<MyHomePage> with TickerProviderStateMixin {
frameBuilder:
(
BuildContext
context
,
Widget
child
,
int
frame
,
int
?
frame
,
bool
wasSynchronouslyLoaded
,
)
{
if
(
frame
==
0
&&
!
completer
.
isCompleted
)
{
...
...
@@ -177,17 +177,17 @@ class _MyHomePageState extends State<MyHomePage> with TickerProviderStateMixin {
@override
Widget
build
(
BuildContext
context
)
{
final
List
<
AnimationController
>
controllers
=
List
<
AnimationController
>.
filled
(
IMAGES
,
null
);
for
(
int
i
=
0
;
i
<
IMAGES
;
i
++)
{
controllers
[
i
]
=
AnimationController
(
duration:
const
Duration
(
milliseconds:
3600
),
vsync:
this
,
)..
repeat
();
}
final
List
<
Completer
<
bool
>>
completers
=
List
<
Completer
<
bool
>>.
filled
(
IMAGES
,
null
);
for
(
int
i
=
0
;
i
<
IMAGES
;
i
++)
{
completers
[
i
]
=
Completer
<
bool
>();
}
final
List
<
AnimationController
>
controllers
=
<
AnimationController
>[
for
(
int
i
=
0
;
i
<
IMAGES
;
i
++)
AnimationController
(
duration:
const
Duration
(
milliseconds:
3600
),
vsync:
this
,
)..
repeat
(),
];
final
List
<
Completer
<
bool
>>
completers
=
<
Completer
<
bool
>>[
for
(
int
i
=
0
;
i
<
IMAGES
;
i
++)
Completer
<
bool
>(),
];
final
List
<
Future
<
bool
>>
futures
=
completers
.
map
(
(
Completer
<
bool
>
completer
)
=>
completer
.
future
).
toList
();
final
DateTime
started
=
DateTime
.
now
();
...
...
examples/image_list/pubspec.yaml
View file @
06f051b2
...
...
@@ -4,7 +4,7 @@ description: Simple Flutter project used for benchmarking image loading over net
version
:
1.0.0+1
environment
:
sdk
:
"
>=2.1
.
0
<3.0.0"
sdk
:
"
>=2.1
2.0-
0
<3.0.0"
dependencies
:
flutter
:
...
...
examples/platform_channel/lib/main.dart
View file @
06f051b2
...
...
@@ -24,7 +24,7 @@ class _PlatformChannelState extends State<PlatformChannel> {
Future
<
void
>
_getBatteryLevel
()
async
{
String
batteryLevel
;
try
{
final
int
result
=
await
methodChannel
.
invokeMethod
(
'getBatteryLevel'
);
final
int
?
result
=
await
methodChannel
.
invokeMethod
(
'getBatteryLevel'
);
batteryLevel
=
'Battery level:
$result
%.'
;
}
on
PlatformException
{
batteryLevel
=
'Failed to get battery level.'
;
...
...
@@ -40,7 +40,7 @@ class _PlatformChannelState extends State<PlatformChannel> {
eventChannel
.
receiveBroadcastStream
().
listen
(
_onEvent
,
onError:
_onError
);
}
void
_onEvent
(
Object
event
)
{
void
_onEvent
(
Object
?
event
)
{
setState
(()
{
_chargingStatus
=
"Battery status:
${event == 'charging' ? '' : 'dis'}
charging."
;
...
...
examples/platform_channel/pubspec.yaml
View file @
06f051b2
name
:
platform_channel
environment
:
sdk
:
"
>=2.
0.0-dev.68.
0
<3.0.0"
sdk
:
"
>=2.
12.0-
0
<3.0.0"
dependencies
:
flutter
:
...
...
examples/platform_channel/test_driver/button_tap_test.dart
View file @
06f051b2
...
...
@@ -2,6 +2,9 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// TODO(goderbauer): migrate this file to null-safety when flutter_driver is null-safe.
// @dart = 2.9
import
'package:flutter_driver/flutter_driver.dart'
;
import
'package:test/test.dart'
hide
TypeMatcher
,
isInstanceOf
;
...
...
examples/platform_channel_swift/lib/main.dart
View file @
06f051b2
...
...
@@ -24,7 +24,7 @@ class _PlatformChannelState extends State<PlatformChannel> {
Future
<
void
>
_getBatteryLevel
()
async
{
String
batteryLevel
;
try
{
final
int
result
=
await
methodChannel
.
invokeMethod
(
'getBatteryLevel'
);
final
int
?
result
=
await
methodChannel
.
invokeMethod
(
'getBatteryLevel'
);
batteryLevel
=
'Battery level:
$result
%.'
;
}
on
PlatformException
{
batteryLevel
=
'Failed to get battery level.'
;
...
...
@@ -40,7 +40,7 @@ class _PlatformChannelState extends State<PlatformChannel> {
eventChannel
.
receiveBroadcastStream
().
listen
(
_onEvent
,
onError:
_onError
);
}
void
_onEvent
(
Object
event
)
{
void
_onEvent
(
Object
?
event
)
{
setState
(()
{
_chargingStatus
=
"Battery status:
${event == 'charging' ? '' : 'dis'}
charging."
;
...
...
examples/platform_channel_swift/pubspec.yaml
View file @
06f051b2
name
:
platform_channel_swift
environment
:
sdk
:
"
>=2.
0.0-dev.68.
0
<3.0.0"
sdk
:
"
>=2.
12.0-
0
<3.0.0"
dependencies
:
flutter
:
...
...
examples/platform_channel_swift/test_driver/button_tap_test.dart
View file @
06f051b2
...
...
@@ -2,6 +2,9 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// TODO(goderbauer): migrate this file to null-safety when flutter_driver is null-safe.
// @dart = 2.9
import
'package:flutter_driver/flutter_driver.dart'
;
import
'package:test/test.dart'
hide
TypeMatcher
,
isInstanceOf
;
...
...
examples/platform_view/lib/main.dart
View file @
06f051b2
...
...
@@ -25,7 +25,7 @@ class PlatformView extends StatelessWidget {
}
class
MyHomePage
extends
StatefulWidget
{
const
MyHomePage
({
Key
key
,
this
.
title
})
:
super
(
key:
key
);
const
MyHomePage
({
Key
?
key
,
required
this
.
title
})
:
super
(
key:
key
);
final
String
title
;
...
...
@@ -46,10 +46,10 @@ class _MyHomePageState extends State<MyHomePage> {
}
Future
<
void
>
_launchPlatformCount
()
async
{
final
int
platformCounter
=
final
int
?
platformCounter
=
await
_methodChannel
.
invokeMethod
(
'switchView'
,
_counter
);
setState
(()
{
_counter
=
platformCounter
;
_counter
=
platformCounter
!
;
});
}
...
...
examples/platform_view/pubspec.yaml
View file @
06f051b2
name
:
platform_view
environment
:
sdk
:
"
>=2.
0.0-dev.68.
0
<3.0.0"
sdk
:
"
>=2.
12.0-
0
<3.0.0"
dependencies
:
flutter
:
...
...
examples/splash/pubspec.yaml
View file @
06f051b2
name
:
splash
environment
:
sdk
:
"
>=2.
0.0-dev.68.
0
<3.0.0"
sdk
:
"
>=2.
12.0-
0
<3.0.0"
dependencies
:
flutter
:
...
...
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