Skip to content

Instantly share code, notes, and snippets.

@stantronic
Last active May 27, 2022 10:17
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 stantronic/1fd7c313979f40e5a071bcc9b12c6ee9 to your computer and use it in GitHub Desktop.
Save stantronic/1fd7c313979f40e5a071bcc9b12c6ee9 to your computer and use it in GitHub Desktop.
Hilt and Dagger Cheatsheet

Terminology

  • Module - a recipe for how to make a thing
  • Component - a kitchen that "cooks up" things according to the recipes
  • Scope - the lifetime of the things created
  • EntryPoint - a place which has its own kitchen

Annotations

  • @Inject - I can be injected, and things can be injected into me
  • @Binds - When a consumer asks for this interface, inject this implementation
  • @Provides - this function shows how to make this thing
  • @AndroidEntryPoint - use on Activies and Fragments to turn them into EntryPoints
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment