Skip to content

update example #1352

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jul 16, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions example/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@ name: webdev_example_app
description: A web app example for webdev CLI.

environment:
sdk: ">=2.10.0 <3.0.0"
sdk: ">=2.12.0 <3.0.0"

dev_dependencies:
build_runner: '>=1.6.2 <2.0.0'
build_web_compilers: ^2.12.0
webdev: ^2.0.0
build_runner: ^2.0.0
build_web_compilers: ^3.0.0
webdev:
path: ../webdev
2 changes: 1 addition & 1 deletion example/web/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ void main() {
print('Hello World');
return ServiceExtensionResponse.result(json.encode({'success': true}));
});
document.body.append(SpanElement()..text = 'Hello World!!');
document.body!.append(SpanElement()..text = 'Hello World!!');

var count = 0;
Timer.periodic(const Duration(seconds: 1), (_) {
Expand Down
18 changes: 9 additions & 9 deletions example/web/scopes_main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import 'dart:collection';
final libraryPublicFinal = MyTestClass();

final _libraryPrivateFinal = 1;
Object libraryNull;
Object? libraryNull;
var libraryPublic = <String>['library', 'public', 'variable'];
var notAList = NotReallyAList();

Expand All @@ -28,7 +28,7 @@ void main() async {
var local = 'local in main';
var intLocalInMain = 42;
var testClass = MyTestClass();
Object localThatsNull;
Object? localThatsNull;
identityMap['a'] = 1;
identityMap['b'] = 2;
map['a'] = [1, 2, 3];
Expand Down Expand Up @@ -81,7 +81,7 @@ abstract class MyAbstractClass {
class MyTestClass<T> extends MyAbstractClass {
final String message;

String notFinal;
String? notFinal;

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

MyTestClass myselfField;
late final MyTestClass myselfField;

var count = 0;

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

Function closure = someFunction;

String Function() tornOff;
late final String Function() tornOff;
}

Function someFunction() => null;
Function? someFunction() => null;

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

class NotReallyAList extends ListBase {
final List _internal;
class NotReallyAList extends ListBase<Object> {
final List<Object> _internal;

NotReallyAList() : _internal = [];

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

@override
operator []=(x, y) => _internal[x] = y;
operator []=(int x, Object y) => _internal[x] = y;

@override
int get length => _internal.length;
Expand Down