getDrawable method

DrawableStyleable? getDrawable(
  1. String id, {
  2. bool nullOk = false,
})

Attempt to lookup a Drawable by id.

Implementation

DrawableStyleable? getDrawable(String id, {bool nullOk = false}) {
  assert(id != null); // ignore: unnecessary_null_comparison
  final DrawableStyleable? value = _drawables[id];
  if (value == null && nullOk != true) {
    throw StateError('Expected to find Drawable with id $id.\n'
        'Have ids: ${_drawables.keys}');
  }
  return value;
}