TypeChecker.fromUrl constructor Null safety

const TypeChecker.fromUrl(
  1. dynamic url
)

Create a new TypeChecker backed by a library url.

Example of referring to a LinkedHashMap from dart:collection:

const linkedHashMap = const TypeChecker.fromUrl(
  'dart:collection#LinkedHashMap',
);

NOTE: This is considered a more brittle way of determining the type because it relies on knowing the absolute path (i.e. after resolved export directives). You should ideally only use fromUrl when you know the full path (likely you own/control the package) or it is in a stable package like in the dart: SDK.

Implementation

const factory TypeChecker.fromUrl(dynamic url) = _UriTypeChecker;