SingleContextEntry.fromString constructor

SingleContextEntry.fromString(
  1. String string
)

Creates a new SingleContextEntry from a string that represents a URI.

If the string should not be a valid URI, this factory constructor will throw a FormatException.

Implementation

factory SingleContextEntry.fromString(String string) {
  final parsedUri = Uri.tryParse(string);

  if (parsedUri == null) {
    throw FormatException("Encountered invalid URI $string");
  }

  return SingleContextEntry(parsedUri);
}