ref<T> function Null safety

  1. @Deprecated('Use [ref0], [ref1], [ref2], ... instead.')
Parser<T> ref<T>(
  1. Function function,
  2. [dynamic arg1 = undefined,
  3. dynamic arg2 = undefined,
  4. dynamic arg3 = undefined,
  5. dynamic arg4 = undefined,
  6. dynamic arg5 = undefined,
  7. dynamic arg6 = undefined,
  8. dynamic arg7 = undefined,
  9. dynamic arg8 = undefined,
  10. dynamic arg9 = undefined]
)

Creates a Parser from a function reference, possibly with the given arguments arg1, arg2, arg3, ...

This method doesn't work well in strong mode as it perform type checks at runtime only. Depending on the argument count of your function consider using one of the strongly typed alternatives ref0, ref1, ref2, ... instead.

Implementation

@Deprecated('Use [ref0], [ref1], [ref2], ... instead.')
Parser<T> ref<T>(
  Function function, [
  dynamic arg1 = undefined,
  dynamic arg2 = undefined,
  dynamic arg3 = undefined,
  dynamic arg4 = undefined,
  dynamic arg5 = undefined,
  dynamic arg6 = undefined,
  dynamic arg7 = undefined,
  dynamic arg8 = undefined,
  dynamic arg9 = undefined,
]) {
  final arguments = [arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9]
      .takeWhile((each) => each != undefined)
      .toList(growable: false);
  return ReferenceParser<T>(function, arguments);
}