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) {
  if (arguments.isEmpty) {
    throw "arguments required in ChartLineWithDataBuilder";
  }
  var data = arguments.first;
  bool animated = false;
  var animatedParsed = namedArguments[const Symbol('animated')];
  if (animatedParsed != null) {
    animated = animatedParsed as bool;
  }
  double height = parseDouble(namedArguments[const Symbol('height')]) ?? 200;
  int titleFontSize = 14;
  var titleFontSizeParsed = namedArguments[const Symbol('titleFontSize')];
  if (titleFontSizeParsed != null) {
    titleFontSize = titleFontSizeParsed as int;
  }
  double maskFontSize =
      parseDouble(namedArguments[const Symbol('maskFontSize')]) ?? 18;
  bool showLegend = true;
  var showLegendParsed = namedArguments[const Symbol('showLegend')];
  if (showLegendParsed != null) {
    showLegend = showLegendParsed as bool;
  }
  var showChartTitle = true;
  var showChartTitleParsed = namedArguments[const Symbol('showChartTitle')];
  if (showChartTitleParsed != null) {
    showChartTitle = showChartTitleParsed as bool;
  }
  double strokeWidth =
      parseDouble(namedArguments[const Symbol('strokeWidth')]) ?? 1;
  bool hidePrimaryAxis = false;
  var hidePrimaryAxisParsed = namedArguments[const Symbol('hidePrimaryAxis')];
  if (hidePrimaryAxisParsed != null) {
    hidePrimaryAxis = hidePrimaryAxisParsed as bool;
  }
  bool hideSecondaryAxis = false;
  var hideSecondaryAxisParsed =
      namedArguments[const Symbol('hideSecondaryAxis')];
  if (hideSecondaryAxisParsed != null) {
    hideSecondaryAxis = hideSecondaryAxisParsed as bool;
  }
  bool hideDomainAxis = false;
  var hideDomainAxisParsed = namedArguments[const Symbol('hideDomainAxis')];
  if (hideDomainAxisParsed != null) {
    hideDomainAxis = hideDomainAxisParsed as bool;
  }
  bool Function(String)? hiddenFn;
  var hiddenFnParsed = namedArguments[const Symbol('hiddenFn')];
  if (hiddenFnParsed != null) {
    hiddenFn = (s) {
      return (hiddenFnParsed as LoxFunction).call(interpreter, [s], {})
          as bool;
    };
  }
  Widget? loadingWidget;
  var loadingWidgetParsed = namedArguments[const Symbol('loadingWidget')];
  if (loadingWidgetParsed != null) {
    loadingWidget = loadingWidgetParsed as Widget;
  }
  bool showAxisLine = false;
  var showAxisLineParsed = namedArguments[const Symbol('showAxisLine')];
  if (showAxisLineParsed != null) {
    showAxisLine = showAxisLineParsed as bool;
  }
  return ChartLine.withChartData(data as List<dynamic>,
      animate: animated,
      height: height,
      titleFontSize: titleFontSize,
      maskFontSize: maskFontSize,
      showLegend: showLegend,
      showChartTitle: showChartTitle,
      strokeWidth: strokeWidth,
      loadingWidget: loadingWidget,
      hidePrimaryAxis: hidePrimaryAxis,
      hiddenFn: hiddenFn,
      showAxisLine: showAxisLine,
      hideSecondaryAxis: hideSecondaryAxis,
      hideDomainAxis: hideDomainAxis);
}