parseImage static method

(String, String?) parseImage(
  1. String image
)

Splits an image reference into the name to pull and its tag: latest when none is given, none for a digest (name@sha256:...).

Implementation

static (String, String?) parseImage(String image) {
  if (image.contains('@')) {
    return (image, null);
  }
  final colon = image.lastIndexOf(':');
  if (colon > image.lastIndexOf('/')) {
    return (image.substring(0, colon), image.substring(colon + 1));
  }
  return (image, 'latest');
}