Skip to content

Commit 1dd110c

Browse files
committed
update example
1 parent 75206f4 commit 1dd110c

File tree

3 files changed

+15
-14
lines changed

3 files changed

+15
-14
lines changed

example/pubspec.yaml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,10 @@ name: webdev_example_app
22
description: A web app example for webdev CLI.
33

44
environment:
5-
sdk: ">=2.10.0 <3.0.0"
5+
sdk: ">=2.12.0 <3.0.0"
66

77
dev_dependencies:
8-
build_runner: '>=1.6.2 <2.0.0'
9-
build_web_compilers: ^2.12.0
10-
webdev: ^2.0.0
8+
build_runner: ^2.0.0
9+
build_web_compilers: ^3.0.0
10+
webdev:
11+
path: ../webdev

example/web/main.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ void main() {
1414
print('Hello World');
1515
return ServiceExtensionResponse.result(json.encode({'success': true}));
1616
});
17-
document.body.append(SpanElement()..text = 'Hello World!!');
17+
document.body!.append(SpanElement()..text = 'Hello World!!');
1818

1919
var count = 0;
2020
Timer.periodic(const Duration(seconds: 1), (_) {

example/web/scopes_main.dart

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import 'dart:collection';
99
final libraryPublicFinal = MyTestClass();
1010

1111
final _libraryPrivateFinal = 1;
12-
Object libraryNull;
12+
Object? libraryNull;
1313
var libraryPublic = <String>['library', 'public', 'variable'];
1414
var notAList = NotReallyAList();
1515

@@ -28,7 +28,7 @@ void main() async {
2828
var local = 'local in main';
2929
var intLocalInMain = 42;
3030
var testClass = MyTestClass();
31-
Object localThatsNull;
31+
Object? localThatsNull;
3232
identityMap['a'] = 1;
3333
identityMap['b'] = 2;
3434
map['a'] = [1, 2, 3];
@@ -81,7 +81,7 @@ abstract class MyAbstractClass {
8181
class MyTestClass<T> extends MyAbstractClass {
8282
final String message;
8383

84-
String notFinal;
84+
String? notFinal;
8585

8686
MyTestClass({this.message = 'world'}) {
8787
myselfField = this;
@@ -104,7 +104,7 @@ class MyTestClass<T> extends MyAbstractClass {
104104
//ignore: avoid_returning_this
105105
MyTestClass get myselfGetter => this;
106106

107-
MyTestClass myselfField;
107+
late final MyTestClass myselfField;
108108

109109
var count = 0;
110110

@@ -129,24 +129,24 @@ class MyTestClass<T> extends MyAbstractClass {
129129

130130
Function closure = someFunction;
131131

132-
String Function() tornOff;
132+
late final String Function() tornOff;
133133
}
134134

135-
Function someFunction() => null;
135+
Function? someFunction() => null;
136136

137137
// ignore: unused_element
138138
int _libraryPrivateFunction(int a, int b) => a + b;
139139

140-
class NotReallyAList extends ListBase {
141-
final List _internal;
140+
class NotReallyAList extends ListBase<Object> {
141+
final List<Object> _internal;
142142

143143
NotReallyAList() : _internal = [];
144144

145145
@override
146146
Object operator [](x) => _internal[x];
147147

148148
@override
149-
operator []=(x, y) => _internal[x] = y;
149+
operator []=(int x, Object y) => _internal[x] = y;
150150

151151
@override
152152
int get length => _internal.length;

0 commit comments

Comments
 (0)