-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Closed
Labels
area-web-jsIssues related to JavaScript support for Dart Web, including DDC, dart2js, and JS interop.Issues related to JavaScript support for Dart Web, including DDC, dart2js, and JS interop.type-questionA question about expected behavior or functionalityA question about expected behavior or functionality
Description
The new interop docs state the following for optional parameters:
Unlike with non-external methods, optional arguments do not get replaced with their default value, but are instead omitted.
See https://dart.dev/interop/js-interop/usage#parameters
However, what if the underlying definition you're using does provide a default argument, which it relies on?
In Dart, default arguments have to be const, but in JS that isn't the case.
Is there any guidance on this?
Concrete example, from the Auth0 JS SDK:
// JS
public async handleRedirectCallback<TAppState = any>(
url: string = window.location.href
): Promise<RedirectLoginResult<TAppState>> {
const queryStringFragments = url.split('?').slice(1);
// irrelevant code...
}
// Dart
external Future<RedirectLoginResult> handleRedirectCallback([
final String? url,
]);
I'm using Dart 3.5.3
Metadata
Metadata
Assignees
Labels
area-web-jsIssues related to JavaScript support for Dart Web, including DDC, dart2js, and JS interop.Issues related to JavaScript support for Dart Web, including DDC, dart2js, and JS interop.type-questionA question about expected behavior or functionalityA question about expected behavior or functionality