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) {
  bool reverse = false;
  var reverseParsed = namedArguments[const Symbol('reverse')];
  if (reverseParsed != null) {
    reverse = reverseParsed as bool;
  }
  var itemCount = namedArguments[const Symbol('itemCount')];
  if (itemCount == null) {
    throw "itemCount required in ListView.separated";
  }
  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";
  }
  var separatorBuilder = namedArguments[const Symbol('separatorBuilder')];
  if (separatorBuilder == null) {
    throw "separatorBuilder required in ListView.separated";
  }
  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.separated(
      scrollDirection: scrollDirection,
      reverse: reverse,
      primary: primary,
      padding: padding,
      shrinkWrap: shrinkWrap,
      itemCount: itemCount as int,
      cacheExtent: cacheExtent,
      itemBuilder: (BuildContext context, int index) {
        return (itemBuilder as LoxCallable)
            .call(interpreter, [context, index], {}) as Widget;
      },
      separatorBuilder: (BuildContext context, int index) {
        return (separatorBuilder as LoxCallable)
            .call(interpreter, [context, index], {}) as Widget;
      });
}