call method Null safety

Object? call(
  1. [List<Object>? args,
  2. Map<Symbol, Object>? namedArgs]
)

Dynamically call this Throttle with the specified arguments.

Acts the same as calling func with positional arguments corresponding to the elements of args and named arguments corresponding to the elements of namedArgs.

This includes giving the same errors if func isn't callable or if it expects different parameters.

Example:

List<Movie> fetchMovies(
   String movieName, {
   bool adult = false,
 }) async {
   final data = api.getData(query);
   doSomethingWithTheData(data);
 }

final throttledFetchMovies = Throttle(
   fetchMovies,
  const Duration(milliseconds: 350),
);

throttledFetchMovies(['tenet'], {#adult: true});

gives exactly the same result as

fetchMovies('tenet', adult: true).

Implementation

Object? call([List<Object>? args, Map<Symbol, Object>? namedArgs]) =>
    _debounce.call(args, namedArgs);