StringScanner constructor Null safety

StringScanner(
  1. String string,
  2. {dynamic sourceUrl,
  3. int? position}
)

Creates a new StringScanner that starts scanning from position.

position defaults to 0, the beginning of the string. sourceUrl is the URL of the source of the string being scanned, if available. It can be a String, a Uri, or null.

Implementation

StringScanner(this.string, {sourceUrl, int? position})
    : sourceUrl = sourceUrl == null
          ? null
          : sourceUrl is String
              ? Uri.parse(sourceUrl)
              : sourceUrl as Uri {
  if (position != null) this.position = position;
}