rules/utils/package_utils library

Utilities for checking which package a type originates from.

Used by Flutter and Riverpod rules to verify that a type (e.g. StatelessWidget, ConsumerWidget) comes from the expected package rather than a user-defined class with the same name.

Functions

isFromExpectedPackage(NamedType namedType, String expectedPackage) bool
Returns true if namedType originates from expectedPackage.
isTypeFromPackage(InterfaceType type, String expectedPackage) bool
Returns true if type originates from expectedPackage.