js_facade_gen icon indicating copy to clipboard operation
js_facade_gen copied to clipboard

The Default function parameters of JavaScript is overwritten.

Open dennougorilla opened this issue 5 years ago • 1 comments

  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 avatar Jul 01 '20 08:07 dennougorilla

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

dennougorilla avatar Jul 01 '20 09:07 dennougorilla