call method

  1. @override
Object? call(
  1. Interpreter interpreter,
  2. List<Object?> arguments,
  3. Map<Symbol, Object?> namedArguments
)
override

Implementation

@override
Object? call(Interpreter interpreter, List<Object?> arguments,
    Map<Symbol, Object?> namedArguments) {
  double? itemExtent =
      parseDouble(namedArguments[const Symbol('itemExtent')]);
  bool reverse = false;
  var reverseParsed = namedArguments[const Symbol('reverse')];
  if (reverseParsed != null) {
    reverse = reverseParsed as bool;
  }
  int? itemCount;
  var itemCountParsed = namedArguments[const Symbol('itemCount')];
  if (itemCountParsed != null) {
    itemCount = itemCountParsed as int;
  }
  Widget? prototypeItem;
  var prototypeItemParsed = namedArguments[const Symbol('prototypeItem')];
  if (prototypeItemParsed != null) {
    prototypeItem = prototypeItemParsed as Widget;
  }
  bool shrinkWrap = false;
  var shrinkWrapParsed = namedArguments[const Symbol('shrinkWrap')];
  if (shrinkWrapParsed != null) {
    shrinkWrap = shrinkWrapParsed as bool;
  }
  bool? primary;
  var primaryParsed = namedArguments[const Symbol('primary')];
  if (primaryParsed != null) {
    primary = primaryParsed as bool;
  }
  EdgeInsetsGeometry? padding;
  var paddingParsed = namedArguments[const Symbol('padding')];
  if (paddingParsed != null) {
    padding = paddingParsed as EdgeInsetsGeometry;
  }
  var itemBuilder = namedArguments[const Symbol('itemBuilder')];
  if (itemBuilder == null) {
    throw "itemBuilder required in ListView.builder";
  }
  Axis scrollDirection = Axis.vertical;
  var scrollDirectionParsed = namedArguments[const Symbol('scrollDirection')];
  if (scrollDirectionParsed != null) {
    scrollDirection = scrollDirectionParsed as Axis;
  }
  double? cacheExtent = parseDouble(namedArguments[const Symbol('cacheExtent')]);
  return ListView.builder(
    scrollDirection: scrollDirection,
    itemExtent: itemExtent,
    prototypeItem: prototypeItem,
    reverse: reverse,
    primary: primary,
    cacheExtent: cacheExtent,
    shrinkWrap: shrinkWrap,
    itemCount: itemCount,
    padding: padding,
    itemBuilder: (BuildContext context, int index) {
      return (itemBuilder as LoxCallable)
          .call(interpreter, [context, index], {}) as Widget;
    },
  );
}