Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
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
1 change: 1 addition & 0 deletions lib/web_ui/build.canvaskit.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ targets:
compiler: dart2js
dart2js_args:
- --no-minify
- --disable-inlining
- --enable-asserts
- --enable-experiment=non-nullable
- --no-sound-null-safety
Expand Down
1 change: 1 addition & 0 deletions lib/web_ui/build.html.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ targets:
compiler: dart2js
dart2js_args:
- --no-minify
- --disable-inlining
- --enable-asserts
- --enable-experiment=non-nullable
- --no-sound-null-safety
Expand Down
1 change: 0 additions & 1 deletion lib/web_ui/lib/src/engine.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

// @dart = 2.6
library engine;

import 'dart:async';
Expand Down
19 changes: 9 additions & 10 deletions lib/web_ui/lib/src/engine/alarm_clock.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

// @dart = 2.6
part of engine;

/// A function that returns current system time.
Expand All @@ -24,13 +23,13 @@ class AlarmClock {
final TimestampFunction _timestampFunction;

/// The underlying timer used to schedule the callback.
Timer _timer;
Timer? _timer;

/// Current target time the [callback] is scheduled for.
DateTime _datetime;
DateTime? _datetime;

/// The callback called when the alarm goes off.
ui.VoidCallback callback;
late ui.VoidCallback callback;

/// The time when the alarm clock will go off.
///
Expand All @@ -39,8 +38,8 @@ class AlarmClock {
/// If the value is updated before an already scheduled timer goes off, the
/// previous time will not call the [callback]. Think of the updating this
/// value as "changing your mind" about when you want the next timer to fire.
DateTime get datetime => _datetime;
set datetime(DateTime value) {
DateTime? get datetime => _datetime;
set datetime(DateTime? value) {
if (value == _datetime) {
return;
}
Expand Down Expand Up @@ -72,7 +71,7 @@ class AlarmClock {
} else {
assert(_datetime != null,
'We can only have a timer if there is a non-null datetime');
if (_datetime.isAfter(value)) {
if (_datetime!.isAfter(value)) {
// This is the case when the value moves the target time to an earlier
// point. Because there is no way to reconfigure an existing timer, we
// must cancel the old timer and schedule a new one.
Expand All @@ -89,7 +88,7 @@ class AlarmClock {

void _cancelTimer() {
if (_timer != null) {
_timer.cancel();
_timer!.cancel();
_timer = null;
}
}
Expand All @@ -100,12 +99,12 @@ class AlarmClock {
final DateTime now = _timestampFunction();
// We use the "not before" logic instead of "is after" because we may have
// zero difference between now and _datetime.
if (!now.isBefore(_datetime)) {
if (!now.isBefore(_datetime!)) {
_timer = null;
callback();
} else {
// The timer fired before the target date. We need to reschedule.
_timer = Timer(_datetime.difference(now), _timerDidFire);
_timer = Timer(_datetime!.difference(now), _timerDidFire);
}
}
}
7 changes: 3 additions & 4 deletions lib/web_ui/lib/src/engine/assets.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

// @dart = 2.6
part of engine;

/// This class downloads assets over the network.
Expand All @@ -17,10 +16,10 @@ class AssetManager {

const AssetManager({this.assetsDir = _defaultAssetsDir});

String get _baseUrl {
String? get _baseUrl {
return html.window.document
.querySelectorAll('meta')
.whereType<html.MetaElement>()
.whereType<html.MetaElement?>()
.firstWhere((dynamic e) => e.name == 'assetBase', orElse: () => null)
?.content;
}
Expand Down Expand Up @@ -58,7 +57,7 @@ class AssetManager {
final ByteBuffer response = request.response;
return response.asByteData();
} on html.ProgressEvent catch (e) {
final html.EventTarget target = e.target;
final html.EventTarget? target = e.target;
if (target is html.HttpRequest) {
if (target.status == 404 && asset == 'AssetManifest.json') {
html.window.console
Expand Down
Loading