Skip to content
This repository has been archived by the owner on Dec 5, 2022. It is now read-only.

The Default function parameters of JavaScript is overwritten. #89

Open
dennougorilla opened this issue Jul 1, 2020 · 1 comment
Open

Comments

@dennougorilla
Copy link

dennougorilla commented Jul 1, 2020

  Future<dynamic> getUser([GetUserOptions options]) {
    final Object t = this;
    final _Auth0Client tt = t;
    return promiseToFuture(tt.getUser(options));
  }

I cannot use the default function parameters because the generated code always contains parameters.
If you want to use the defalut function parameter set in the library, you have to remove the parameter from the generated code as a temporary workaround.
return promiseToFuture(tt.getUser());

@dennougorilla
Copy link
Author

This may be fine...

  Future<dynamic> getUser([GetUserOptions options]) {
    final Object t = this;
    final _Auth0Client tt = t;
    var result = promiseToFuture(tt.getUser());
    if (options != null) {
      result = promiseToFuture(tt.getUser(options));
    }
    return result;
  }

https://dart.dev/guides/language/language-tour#optional-parameters

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

No branches or pull requests

1 participant