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) {
  Stream? stream;
  var streamParsed = namedArguments[const Symbol('stream')];
  if (streamParsed != null) {
    stream = streamParsed as Stream;
  }
  var builder = namedArguments[const Symbol('builder')];
  if (builder == null) {
    throw "builder required in StreamBuilder";
  }
  var initialData = namedArguments[const Symbol('initialData')];
  return StreamBuilder(
    stream: stream,
    initialData: initialData,
    builder: (context, snapshot) {
      return (builder as LoxFunction).call(
          interpreter, [context, AsyncSnapshotIns(snapshot)], {}) as Widget;
    },
  );
}