newLayer function

Layer newLayer(
  1. Object content, [
  2. List<Layer> layers = const []
])

Creates a new Layer from a String or Drawable.

Throws an ArgumentError if content is neither.

Implementation

Layer newLayer(Object content, [List<Layer> layers = const []]) {
  if (content is Drawable) {
    return Layer(content, layers);
  } else if (content is String) {
    return Layer(StyledString(content), layers);
  } else {
    throw ArgumentError('content must be a String or Drawable');
  }
}