Creates multiple providers matching the same token (a multi-provider).
Multi-providers are used for creating pluggable service, where the system comes with some default providers, and the user can register additional providers. The combination of the default providers and the additional providers will be used to drive the behavior of the system.
var injector = Injector.resolveAndCreate([
new Provider("Strings", useValue: "String1", multi: true),
new Provider("Strings", useValue: "String2", multi: true)
]);
expect(injector.get("Strings"), ["String1", "String2"]);
Multi-providers and regular providers cannot be mixed. The following will throw an exception:
var injector = Injector.resolveAndCreate([
new Provider("Strings", { useValue: "String1", multi: true }),
new Provider("Strings", { useValue: "String2"})
]);
Source
bool get multi => _multi ?? false;