Skip to content

Instantly share code, notes, and snippets.

@letsar
Created September 8, 2018 17:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save letsar/7530f4cb03961b94a91bab49f3c87701 to your computer and use it in GitHub Desktop.
Save letsar/7530f4cb03961b94a91bab49f3c87701 to your computer and use it in GitHub Desktop.
// Registers a new factory.
container.registerFactory((c) => Sith('Anakin', 'Skywalker'));
// Registers a new factory with a specified name.
container.registerFactory((c) => Sith('Anakin', 'Skywalker'), name: 'DartVader');
// Registers a new factory, with a specified name, and under a supertype.
container.registerFactory<Character, Sith>((c) => Sith('Anakin', 'Skywalker'), name: 'DartVader');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment