Profile constructor

const Profile(
  1. List<String> profiles, {
  2. bool negate = false,
})

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
}

Implementation

const Profile(this.profiles, {this.negate = false});