TechnicalIndicators<T, D> constructor Null safety

TechnicalIndicators<T, D>(
  1. {bool? isVisible,
  2. String? xAxisName,
  3. String? yAxisName,
  4. String? seriesName,
  5. List<double>? dashArray,
  6. double? animationDuration,
  7. List<T>? dataSource,
  8. ChartValueMapper<T, D>? xValueMapper,
  9. ChartValueMapper<T, num>? lowValueMapper,
  10. ChartValueMapper<T, num>? highValueMapper,
  11. ChartValueMapper<T, num>? openValueMapper,
  12. ChartValueMapper<T, num>? closeValueMapper,
  13. String? name,
  14. bool? isVisibleInLegend,
  15. LegendIconType? legendIconType,
  16. String? legendItemText,
  17. Color? signalLineColor,
  18. double? signalLineWidth,
  19. int? period}
)

Creating an argument constructor of TechnicalIndicators class.

Implementation

TechnicalIndicators(
    {bool? isVisible,
    this.xAxisName,
    this.yAxisName,
    this.seriesName,
    List<double>? dashArray,
    double? animationDuration,
    this.dataSource,
    ChartValueMapper<T, D>? xValueMapper,
    ChartValueMapper<T, num>? lowValueMapper,
    ChartValueMapper<T, num>? highValueMapper,
    ChartValueMapper<T, num>? openValueMapper,
    ChartValueMapper<T, num>? closeValueMapper,
    this.name,
    bool? isVisibleInLegend,
    LegendIconType? legendIconType,
    this.legendItemText,
    Color? signalLineColor,
    double? signalLineWidth,
    int? period})
    : isVisible = isVisible ?? true,
      dashArray = dashArray ?? <double>[0, 0],
      animationDuration = animationDuration ?? 1500,
      isVisibleInLegend = isVisibleInLegend ?? true,
      legendIconType = legendIconType ?? LegendIconType.seriesType,
      signalLineColor = signalLineColor ?? Colors.blue,
      signalLineWidth = signalLineWidth ?? 2,
      period = period ?? 14,
      xValueMapper = (xValueMapper != null)
          ? ((int index) => xValueMapper(dataSource![index], index))
          : null,
      lowValueMapper = (lowValueMapper != null)
          ? ((int index) => lowValueMapper(dataSource![index], index))
          : null,
      highValueMapper = (highValueMapper != null)
          ? ((int index) => highValueMapper(dataSource![index], index))
          : null,
      openValueMapper = (openValueMapper != null)
          ? ((int index) => openValueMapper(dataSource![index], index))
          : null,
      closeValueMapper = (closeValueMapper != null)
          ? ((int index) => closeValueMapper(dataSource![index], index))
          : null;