InjectableInit class

// Marks a top-level function as an initializer function for configuring Get_it

Annotations
  • @Target.new({TargetKind.function})

Constructors

InjectableInit({List<String> generateForDir = const ['lib'], String? rootDir, bool preferRelativeImports = false, String initializerName = 'init', List<Type> ignoreUnregisteredTypes = const [], List<String> ignoreUnregisteredTypesInPackages = const [], bool asExtension = true, bool throwOnMissingDependencies = false, List<ExternalModule>? externalPackageModulesAfter, List<ExternalModule>? externalPackageModulesBefore, bool usesConstructorCallback = false, bool generateAccessors = false, Set<Environment> generateForEnvironments = const {}, bool allowMultipleRegistrations = false})
default constructor
const
InjectableInit.microPackage({List<String> generateForDir = const ['lib'], bool preferRelativeImports = false, List<Type> ignoreUnregisteredTypes = const [], List<ExternalModule>? externalPackageModulesAfter, List<ExternalModule>? externalPackageModulesBefore, bool usesConstructorCallback = false, bool throwOnMissingDependencies = false, List<String> ignoreUnregisteredTypesInPackages = const [], Set<Environment> generateForEnvironments = const {}})
default constructor
const

Properties

allowMultipleRegistrations → bool
Whether to enable GetIt's multiple registrations feature. When true, generates a call to getIt.enableRegisteringMultipleInstancesOfOneType() at the start of the init function. This allows registering multiple instances of the same type without names. See: https://flutter-it.dev/documentation/get_it/multiple_registrations Defaults to false.
final
asExtension → bool
if true the init function will be generated inside of a GetIt extension defaults to true
final
externalPackageModulesAfter → List<ExternalModule>?
a List of external package modules to be registered in the default package initializer after root dependencies classes passed here must extend MicroPackageModule
final
externalPackageModulesBefore → List<ExternalModule>?
a List of external package modules to be registered in the default package initializer before root dependencies classes passed here must extend MicroPackageModule
final
generateAccessors → bool
Whether to generate small helper accessors for registered types (GetIt extension getters). Example: Service get service => get<Service>(). Defaults to false.
final
generateForDir → List<String>
Only files exist in provided directories will be processed
final
generateForEnvironments → Set<Environment>
a Set of environments to generate for. if not provided, code for all environments will be generated. defaults to empty
final
hashCode → int
The hash code for this object.
no setterinherited
ignoreUnregisteredTypes → List<Type>
generator will not show warning for unregistered types included in this list
final
ignoreUnregisteredTypesInPackages → List<String>
generator will not show warning for unregistered types if import start with any string included in this list
final
initializerName → String
generated initializer name defaults to $init
final
preferRelativeImports → bool
if true relative imports will be used where possible defaults to false
final
rootDir → String?
If rootDir is provided, generation processes will continue through this dir. You can define the rootDir in the following two ways:
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
throwOnMissingDependencies → bool
throw an error and abort generation in case of missing dependencies defaults to false
final
usesConstructorCallback → bool
feature flag to activate a 'constructor callback'. Setting this to 'true' will generate an additional parameter to '$initGetIt' - named "constructorCallback" - a function of signature "T constructorCallback%lt;T%gt;(T)". Injectable will pass all injectable objects to this delegate at the time of their constructor/module-method invocation. defaults to false
final

Methods

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