deduplicateProviders method
Returns a unique ordered-set based off of providers
.
ProviderElement.token is used to determine uniqueness.
Implementation
List<ProviderElement> deduplicateProviders(
Iterable<ProviderElement> providers,
) {
final soloProviders = LinkedHashSet<ProviderElement>(
equals: (a, b) => a.token == b.token,
hashCode: (e) => e.token.hashCode,
isValidKey: (e) => e is ProviderElement,
)..addAll(providers.where((e) => !e.isMulti).toList().reversed);
return soloProviders.toList()..addAll(providers.where((e) => e.isMulti));
}