resolve method

Color resolve (
  1. Color resolvable,
  2. BuildContext context,
  3. {bool nullOk: true}
)

Resolves the given Color by calling resolveFrom.

If the given color is already a concrete Color, it will be returned as is. If the given color is null, returns null. If the given color is a CupertinoDynamicColor, but the given BuildContext lacks the dependencies required to the color resolution, the default trait value will be used (Brightness.light platform brightness, normal contrast, CupertinoUserInterfaceLevelData.base elevation level), unless nullOk is set to false, in which case an exception will be thrown.

Implementation

static Color resolve(Color resolvable, BuildContext context, { bool nullOk = true }) {
  if (resolvable == null)
    return null;
  assert(context != null);
  return (resolvable is CupertinoDynamicColor)
    ? resolvable.resolveFrom(context, nullOk: nullOk)
    : resolvable;
}