{"id":13552318,"url":"https://github.com/f3ath/klizma","last_synced_at":"2025-04-22T19:02:18.151Z","repository":{"id":52970949,"uuid":"324639182","full_name":"f3ath/klizma","owner":"f3ath","description":"A minimalistic DI (Dependency Injection) container for Dart.","archived":false,"fork":false,"pushed_at":"2022-12-13T06:25:58.000Z","size":18,"stargazers_count":6,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-17T10:26:26.046Z","etag":null,"topics":["dart","dependency-injection","flutter"],"latest_commit_sha":null,"homepage":"https://pub.dev/packages/klizma","language":"Dart","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/f3ath.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-12-26T21:38:30.000Z","updated_at":"2023-12-27T04:49:21.000Z","dependencies_parsed_at":"2022-09-03T04:51:04.806Z","dependency_job_id":null,"html_url":"https://github.com/f3ath/klizma","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/f3ath%2Fklizma","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/f3ath%2Fklizma/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/f3ath%2Fklizma/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/f3ath%2Fklizma/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/f3ath","download_url":"https://codeload.github.com/f3ath/klizma/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250306605,"owners_count":21408925,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["dart","dependency-injection","flutter"],"created_at":"2024-08-01T12:02:02.172Z","updated_at":"2025-04-22T19:02:17.978Z","avatar_url":"https://github.com/f3ath.png","language":"Dart","funding_links":[],"categories":["Dart"],"sub_categories":[],"readme":"# klizma\nA minimalistic DI (Dependency Injection) container for Dart. Inspired by [injector](https://pub.dev/packages/injector).\n\n- Extra lightweight\n- No external dependencies\n- Supports singletons and named factories\n```dart\nimport 'package:klizma/klizma.dart';\n\nvoid main() {\n  // Create the DI container:\n  final di = Klizma();\n  // Add a factory for type `Engine`:\n  di.provide((_) =\u003e Engine('Vroom!'));\n  // Add a named factory for type `Engine`:\n  di.provide((_) =\u003e Engine('Whoosh!'), name: 'electric');\n  // Add a factory for type `Horn`:\n  di.provide((_) =\u003e Horn('Honk!'));\n  // Add a factory for type `Car` using default instances of `Engine` and `Horn`:\n  di.provide((_) =\u003e Car(_\u003cEngine\u003e(), _\u003cHorn\u003e()));\n  // Add a named factory for type `Car` using the named factory for `Engine`\n  // and the default factory for `Horn`:\n  di.provide((_) =\u003e Car(_\u003cEngine\u003e('electric'), _\u003cHorn\u003e()), name: 'tesla');\n\n  // Build an instance of type `Car`\n  final car = di.get\u003cCar\u003e();\n  /*\n  Prints the following:\n  =====================\n  Engine created.\n  Horn created.\n  Car created.\n  */\n\n  print(car.sound); // Vroom! Honk!\n\n  final tesla = di.get\u003cCar\u003e('tesla');\n  /*\n  Prints the following. Note that the horn is reused:\n  =====================\n  Engine created.\n  Car created.\n  */\n\n  print(tesla.sound); // Whoosh! Honk!\n}\n\nclass Engine {\n  Engine(this.sound) {\n    print('Engine created.');\n  }\n\n  final String sound;\n}\n\nclass Horn {\n  Horn(this.sound) {\n    print('Horn created.');\n  }\n\n  final String sound;\n}\n\nclass Car {\n  Car(this.engine, this.horn) {\n    print('Car created.');\n  }\n\n  final Engine engine;\n  final Horn horn;\n\n  String get sound =\u003e '${engine.sound} ${horn.sound}';\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ff3ath%2Fklizma","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ff3ath%2Fklizma","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ff3ath%2Fklizma/lists"}