getAllDeclaredInterfaces abstract method
Gets all directly declared interfaces (non-transitive).
Returns:
- List of interfaces explicitly declared on this class
- Empty list if no interfaces declared
- Does NOT include inherited interfaces from superclasses
Declared vs All Interfaces
- getDeclaredInterfaces(): Only direct
implements
declarations - getAllInterfaces(): Includes inherited interfaces from hierarchy
Example:
interface class Readable {}
interface class Writable {}
class BaseStream implements Readable {}
class FileStream extends BaseStream implements Writable {}
final fileClass = Class.forType<FileStream>();
final declared = fileClass.getAllDeclaredInterfaces(); // [Writable]
final all = fileClass.getAllInterfaces(); // [Writable, Readable]
Implementation
List<Class> getAllDeclaredInterfaces();