Profile class

Profile annotation for profile-specific pods

This annotation indicates that a component is only eligible for registration when specific profiles are active.

Example Usage:

@Component()
@Profile(['development'])
class DevDatabaseService implements DatabaseService {
  // Only active in development profile
}

@Component()
@Profile(['production'])
class ProdDatabaseService implements DatabaseService {
  // Only active in production profile
}

@Configuration()
@Profile(['test', 'integration'])
class TestConfig {
  // Configuration only for test or integration profiles
  
  @Pod()
  MockService mockService() {
    return MockService();
  }
}

@Component()
@Profile(['!production']) // Not in production
class DebugService {
  // Active in all profiles except production
}
Annotations
  • @Target.new({TargetKind.classType})

Constructors

Profile(List<String> profiles, {bool negate = false})
Profile annotation for profile-specific pods
const
Profile.not(List<String> profiles)
Create a profile annotation that excludes certain profiles
const

Properties

annotationType Type
Returns the annotation _type of this annotation.
no setter
hashCode int
The hash code for this object.
no setterinherited
negate bool
Whether to negate the profile expression
final
profiles List<String>
Profile expressions
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

equalizedProperties() List<Object?>
Mixin-style contract for value-based equality, hashCode, and toString.
equals(Object other) bool
Checks whether the given object is logically equivalent to this annotation.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
Returns a string representation of this annotation.

Operators

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