Refactor JSNumber.toDart and Object.toJS (#129436)

JSNumber.toDart will now be two functions: toDartDouble and toDartInt.

There was code that did an Object.toJS. This has been changed to
use Function.toJS as well to make it consistent with the code
in flutter/packages:
0ef393811d/packages/web_benchmarks/lib/src/recorder.dart (L1223)

This is to help land this CL:
https://dart-review.googlesource.com/c/sdk/+/309082

https://dart-review.googlesource.com/c/sdk/+/309081 is the CL that added
the new methods.

## Pre-launch Checklist

- [X] I read the [Contributor Guide] and followed the process outlined
there for submitting PRs.
- [X] I read the [Tree Hygiene] wiki page, which explains my
responsibilities.
- [X] I read and followed the [Flutter Style Guide], including [Features
we expect every widget to implement].
- [X] I signed the [CLA].
- [X] I listed at least one issue that this PR fixes in the description
above.
- [X] I updated/added relevant documentation (doc comments with `///`).
- [ ] I added new tests to check the change I am making, or this PR is
[test-exempt].
- [x] All existing and new tests are passing.
This commit is contained in:
Srujan Gaddam
2023-07-12 13:54:15 -07:00
committed by GitHub
parent a189d95ac2
commit ab39bff282
3 changed files with 9 additions and 13 deletions

View File

@@ -1336,9 +1336,7 @@ void registerEngineBenchmarkValueListener(String name, EngineBenchmarkValueListe
if (_engineBenchmarkListeners.isEmpty) {
// The first listener is being registered. Register the global listener.
web.window['_flutter_internal_on_benchmark'.toJS] =
// Upcast to [Object] to export.
// ignore: unnecessary_cast
(_dispatchEngineBenchmarkValue as Object).toJS;
_dispatchEngineBenchmarkValue.toJS;
}
_engineBenchmarkListeners[name] = listener;
}