Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit ca41476

Browse files
committed
Refactor JSNumber.toDart and Object.toJS
JSNumber.toDart will now be two functions: toDartDouble and toDartInt. Note that some code that looks like `toDart.toInt()` was kept as `toDartDouble.toInt()` instead of `toDartInt`, since `toDartInt` throws if the value is not an integer. Object.toJS is now Object.toJSBox. An actual box is introduced on all backends now, and is unwrapped in JSBoxedDartObject.toDart. There are many usages of toJSAnyShallow that we should modify, but that's for a later CL.
1 parent c1abd1f commit ca41476

10 files changed

Lines changed: 168 additions & 173 deletions

File tree

lib/web_ui/lib/src/engine/canvaskit/canvaskit_api.dart

Lines changed: 72 additions & 72 deletions
Large diffs are not rendered by default.

lib/web_ui/lib/src/engine/canvaskit/image.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -205,10 +205,10 @@ Future<Uint8List> readChunked(HttpFetchPayload payload, int contentLength, WebOn
205205
int position = 0;
206206
int cumulativeBytesLoaded = 0;
207207
await payload.read<JSUint8Array1>((JSUint8Array1 chunk) {
208-
cumulativeBytesLoaded += chunk.length.toDart.toInt();
208+
cumulativeBytesLoaded += chunk.length.toDartInt;
209209
chunkCallback(cumulativeBytesLoaded, contentLength);
210210
result.set(chunk, position.toJS);
211-
position += chunk.length.toDart.toInt();
211+
position += chunk.length.toDartInt;
212212
});
213213
return result.toDart;
214214
}

lib/web_ui/lib/src/engine/configuration.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -312,7 +312,7 @@ extension JsFlutterConfigurationExtension on JsFlutterConfiguration {
312312

313313
@JS('canvasKitMaximumSurfaces')
314314
external JSNumber? get _canvasKitMaximumSurfaces;
315-
double? get canvasKitMaximumSurfaces => _canvasKitMaximumSurfaces?.toDart;
315+
double? get canvasKitMaximumSurfaces => _canvasKitMaximumSurfaces?.toDartDouble;
316316

317317
@JS('debugShowSemanticsNodes')
318318
external JSBoolean? get _debugShowSemanticsNodes;

0 commit comments

Comments
 (0)