Profile class

Profile annotation for environment-specific beans

Allows conditional registration of beans based on active profiles. Useful for having different implementations for different environments (development, testing, production).

Example:

@Service()
@Profile('development')
class DevEmailService implements EmailService {
  void sendEmail(String to, String subject, String body) {
    print('DEV: Sending email to $to: $subject');
  }
}

@Service()
@Profile('production')
class ProdEmailService implements EmailService {
  void sendEmail(String to, String subject, String body) {
    // Real email sending logic
  }
}

// Usage with multiple profiles
@Profile.multiple(['test', 'integration'])
@Service()
class TestDatabaseService implements DatabaseService { }

Constructors

Profile(String? profile)
Creates a profile annotation with a single profile
const
Profile.multiple(List<String>? profiles)
Creates a profile annotation with multiple profiles
const

Properties

hashCode int
The hash code for this object.
no setterinherited
profile String?
The profile name for single profile annotations
final
profiles List<String>?
The profile names for multiple profile annotations
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

getProfiles() List<String>
Gets all profiles as a list
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited