flutter_charts library Null safety

This file root/lib/flutter_charts.dart IS the flutter_charts package, and can be used by external code OR code inside the same lib..

Basically, files exported in this file, for example

export 'src/chart/data.dart';

are visible to external applications (to which the contents of the lib directory is copied through pub) using code like this

  > import 'package:flutter_charts/flutter_charts.dart';

Code under root/lib directory 1. can use same import 'package:etc' as above external code 2. or file scheme, e.g. > import 'src/chart/data.dart';

Any dart file (any client application) located outside of the "lib" directory just above, can only see the classes contained in the exported packages listed in this file, flutter_chart.dart.

Why? The reasons are complex combination of Dart conventions.

  1. First: what makes the directory structure starting from the top level flutter_charts (call it root directory) a “library package” (or ”pub package”) named flutter_charts? Four requirements must be satisfied:

    1. In the root directory, the existence of file pubspec.yaml.
    2. In pubspec.yaml, the presence of the following line name: flutter_charts. This line gives the library it's name on pub.
    3. Under the root directory, the existence of directory lib.
    4. Under lib, the existence of file named flutter_charts.dart. This file contains the exported dart files (libraries)
  2. Second: Why is this file needed? Because dart tools have the convention to consider everything under lib/src private and not visible to external Dart files (if we were too, for example, copy the whole root directory under flutter_charts to some other project). So this file, flutter_charts.dart provides the public API to our package flutter_charts. All classes (and oly those classes) listed "exported" in this file, are visible externally.

  3. Third: Why so complicated? This is an unfortunate result Dart not being Newspeak :) a Dart appologetic, this is the Dart way of providing ability to create private classes in public libraries we share with the world.

Notes:

  1. Paths in export the lib level is skipped starting with the ‘src’ representing Private. export 'src/chart/torefactor/line_chart.dart'; // even though under lib
  2. Generally, external code can import all classes in one library in one line, referencing this file import 'package:flutter_charts/flutter_charts.dart';
  3. We can say that **files below the lib/src directory in Dart, are by convention, private, and invisible above the lib directory.
  4. Equivalent export syntaxes
    • export 'src/chart/data.dart'
    • export 'package:flutter_charts/src/chart/data.dart'

Note: Export path starts after lib, whether using 'package:flutter_charts' format or 'src/' format.

Classes

AdjustableContent
A marker of container with adjustable contents, such as labels that can be skipped.
AdjustableContentChartAreaContainer
Provides ability to connect LabelLayoutStrategy to Container, (actually currently the ChartAreaContainer.
AxisLabelContainer
Subclass of LabelContainer is extended with member parentOffsetTick, which maintains the container's center position in immediate parent's coordinates. [...]
ChartAreaContainer
Base class which manages, lays out, moves, and paints each top level block on the chart. The basic top level chart blocks are: [...]
ChartContainer
Containers calculate coordinates of chart points used for painting grid, labels, chart points etc. [...]
ChartData
ChartOptions
Options for chart allow to configure certain sizes, colors, and layout. [...]
Container
Base class which manages, lays out, moves, and paints graphical elements on the chart, for example individual labels, but also a collection of labels. [...]
DataContainer
Manages the core chart area which displays, overlayed: [...]
DefaultIterativeLabelLayoutStrategy
Strategy of achieving that labels "fit" on the X axis. [...]
GridLinesContainer
Interval
LabelContainer
Container of one label anywhere on the chart, in Labels, Axis, Titles, etc. [...]
LabelInfo
Manages labels and their values: scaled in , unscaled, and presented (formatted) [...]
LabelLayoutStrategy
Base class for layout strategies. [...]
LabelStyle
Class for value objects which group the text styles that may affect LabelContainer's instances layout.
LayoutExpansion
todo-00-last : review docs Defines how a container layout should expand the container in a direction. [...]
LegendContainer
Lays out the legend area for the chart. [...]
LegendItemContainer
Represents one layed out item of the legend: The rectangle for the color indicator, _indicatorRect, followed by the series label text.
LineChart
Provides paint for the line chart. [...]
LineChartContainer
Container of the line chart. [...]
LineChartOptions
LineChartPainter
Paints the columns of the line chart. [...]
PointsColumn
A column of value points, with support for stacked type charts. [...]
PointsColumns
A list of PointsColumn instances. [...]
Poly
A minimal polynomial needed for Y label and axis scaling. [...]
RandomChartData
Generator of sample data for testing the charts.
Range
Scalable range, supporting creation of scaled x and y axis labels.
StackableValuePoint
Represents values and coordinates of one presented atom of data (x and y). [...]
VerticalBarChart
Provides paint for the vertical bar chart. [...]
VerticalBarChartContainer
Container of the vertical bar chart. [...]
VerticalBarChartOptions
VerticalBarChartPainter
Paints the columns of the bar chart. [...]
XContainer
Container of the X axis labels. [...]
YContainer
Container of the Y axis labels. [...]
YScalerAndLabelFormatter
Encapsulating Y axis scaling (dataRange scaling to available pixels) and Y Labels creation and formatting.

Properties

epsilon double
read-only

Functions

scaleValue({required double value, required double ownScaleMin, required double ownScaleMax, required double toScaleMin, required double toScaleMax}) double
Scale the value that must be from the scale given by ownScaleMin - ownScaleMax to the "to scale" given by toScaleMin - toScaleMax. [...]
transpose(List<List<StackableValuePoint>> colsInRows) List<List<StackableValuePoint>>
Assuming even length 2D matrix colsRows, return it's transpose copy.

Enums

ExpansionStyle
LabelFitMethod