toModelImageUri method

ModelImageUri? toModelImageUri()

Convert to ModelImageUri.

If path is empty, null is returned.

Returns an error if the original FormMediaType is not FormMediaType.image.

ModelImageUriに変換します。

pathが空の場合はnullを返します。

元のFormMediaTypeFormMediaType.imageでない場合はエラーを返します。

Implementation

ModelImageUri? toModelImageUri() {
  if (uri.isEmpty) {
    return null;
  }
  if (type != FormMediaType.image) {
    throw Exception("The original FormMediaType is not FormMediaType.image");
  }
  return ModelImageUri(uri);
}