fetchIcon static method

IconData fetchIcon(
  1. String uri, {
  2. XIconType? type,
})

Implementation

static IconData fetchIcon(String uri, {XIconType? type}) {
  if (type == null) {
    type = typeFromUri(uri);
  }

  if (type == XIconType.MATERIAL_NATIVE) {
    final name = nameFromUri(uri);
    return MATERIAL_ICONS_MAPPING[name]!;
  } else if (type == XIconType.CUSTOM_FONT) {
    final namespace = namespaceFromUri(uri);
    return _registry[namespace]![uri]!;
  } else {
    throw FlutterError(
        "given uri : $uri cannot be fetched from XIcons registry with type $type");
  }
}