- Initial fully functional release
- Fix issues with pub.dev publishing
- Downgrading Dart requirements to match pub.dev and refactoring project structure
- Added portuguese documentation as well as some fixes in the English README.md version
- Add platform info to
ServiceProvider
so injected classes can be chosen by platform as well
- Allows override of registrations (for unit test mocking purposes, for instance)
- Allows override of registrations even before the registrations take place
- Refactoring to separate write/query methods from
ServiceProvider
- BREAKING CHANGE: write methods (i.e.:
registerTransient
) no longer requiresServiceProvider.instance
(they are now static methods) - BREAKING CHANGE: During registration, a
IServiceProvider
is available only with query methods (isRegistered
,optional
andrequired
) - BREAKING CHANGE: to avoid conflict with the
@override
attribute, theoverride
method was renamed toreplace
- Added
registerSingletonIfNotRegistered
andregisterTransientIfNotRegistered
to avoid throwing exceptions and making registration idempotent
- Fixed some grammar errors and refactored the barrel file to make import easier
- BREAKING CHANGE: now
registerTransient
andregisterSingleton
have the following signature:(optional, required, platform)
, so you can inject optional and required services in a easier way:
ServiceProvider.registerTransient<SomeAbstractClass>(
(optional, required, platform) => SomeConcreteClassWithDependencies(
dependencyA: optional<DependencyA>(),
dependencyB: required<DependencyB>(),
platform: platform,
),
);
class SomeConcreteClassWithDependencies {
SomeConcreteClassWithDependencies({
this.dependencyA,
this.dependencyB,
this.platform,
});
final DependencyA dependencyA;
final DependencyB dependencyB;
final IPlatformInfo platform;
}
-
Also,
getService<T>()
was renamed tooptional<T>()
andgetRequiredService<T>()
was renamed torequired<T>()
. -
Now you can implement
IMustBeTransient
orIMustBeSingleton
in your services to validate the required type of registration (i.e.: a class that implementsIMustBeTransient
will throw aInvalidRegistrationModalForTypeException
, if you try to register it withServiceProvider.registerTransient<ClassThatImplementsIMustBeTransient>((optional, required, platform) => SomeClass())
)
- Added the
PlatformDesignSystem platformDesignSystem
property inIPlatformInfo
, so you can quickly determine what kind of design system the host platform uses (Material Design for Linux and Android, Apple Human Interface for MacOS or iOS, Fluent Design for Windows)
-
More methods added, such as
registerOrReplaceTransient
,override
,isRegisteredAsSingleton
, etc. -
New interface
IInitializable
that will runService.initialize()
every time an instance ofService
is created. -
BREAKING CHANGE: The
replace
method was renamed tooverride
. The newreplace
method will replace an existing registration (or throws an error if the service isn't registered)
- Add
toString
overrides to all exceptions
- Fixing some dependencies export
- Changing the license from GPL3 to BSD3
PlatformInfo
is now publicly available throughServiceProvider
- BREAKING CHANGE:
PlatformInfo
now has anativePlatform
to get info about where is the app running (regarding a native Flutter app (android, ios, windows, etc.) or Flutter web)