colorOrBlack static method

Color colorOrBlack(
  1. DataSource source,
  2. List<Object> key
)

Returns a Color from the specified integer.

Returns black if it's not an integer; otherwise, passes it to the Color constructor.

This is useful in situations where null is not acceptable, for example, when providing a decoder to list. Otherwise, prefer using DataSource.v directly.

Implementation

static Color colorOrBlack(DataSource source, List<Object> key) {
  return color(source, key) ?? const Color(0xFF000000);
}