Skip to content

Instantly share code, notes, and snippets.

@letsar
Created September 8, 2018 17:57
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/d39f9053ff183247103b016aea608cb6 to your computer and use it in GitHub Desktop.
Save letsar/d39f9053ff183247103b016aea608cb6 to your computer and use it in GitHub Desktop.
// Registers a new singleton.
container.registerSingleton((c) => Sith('Anakin', 'Skywalker'));
// Registers a new singleton with a specified name.
container.registerSingleton((c) => Sith('Anakin', 'Skywalker'), name: 'DartVader');
// Registers a new singleton, with a specified name, and under a supertype.
container.registerSingleton<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