Compile-time dependency injection for Dart and Flutter

Overview

package:inject

Build Status

Compile-time dependency injection for Dart and Flutter, similar to Dagger.

NOTE: This is not an official Google or Dart team project.

Example code TBD.

Getting Started

TBD.

FAQ

Why is the issue tracker disabled?

This library is currently offered as-is (developer preview) as it is open-sourced from an internal repository inside Google. As such we are not able to act on bugs or feature requests at this time.

What do you mean by compile-time?

All dependency injection is analyzed, configured, and generated at compile-time as part of a build process, and does not rely on any runtime setup or configuration (such as reflection with dart:mirrors). This provides the best experience in terms of code-size and performance (it's nearly identical to hand written code) and allows us to provide compile-time errors and warnings instead of relying on runtime.

Can I use this with Flutter?

Yes, package:inject is framework and platform agnostic, and works perfectly well with Flutter or any other framework. We'll be releasing more documentation and samples of using this package with flutter in the future.

Can I use this with AngularDart?

While technically, yes (package:inject is framework and platform agnostic), the existing dependency injection framework in AngularDart is better suited for the idioms of that framework. We welcome experimentation and new ideas, though!

Can I use this with server-side Dart?

Yes, package:inject is framework and platform agnostic, and works perfectly well with any server-side Dart framework. You may want to consult your specific framework though - they might already have a preferred dependency injection pattern.

You might also like...

Dependency Injection is a great design pattern that allows us to eliminate rigid dependencies between elements and it makes the application more flexible

Dependency Injection is a great design pattern that allows us to eliminate rigid dependencies between elements and it makes the application more flexible

GetX lib DI pattern Dependency Injection is a great design pattern that allows us to eliminate rigid dependencies between elements and it makes the ap

Feb 1, 2022

Arisprovider - A mixture between dependency injection (DI) and state management, built with widgets for widgets

A mixture between dependency injection (DI) and state management, built with wid

Jan 9, 2022

[Flutter SDK V.2] - Youtube Video is a Flutter application built to demonstrate the use of Modern development tools with best practices implementation like Clean Architecture, Modularization, Dependency Injection, BLoC, etc.

[Flutter SDK V.2] - Youtube Video is a Flutter application built to demonstrate the use of Modern development tools with best practices implementation like Clean Architecture, Modularization, Dependency Injection, BLoC, etc.

[Flutter SDK V.2] - Youtube Video is a Flutter application built to demonstrate the use of Modern development tools with best practices implementation like Clean Architecture, Modularization, Dependency Injection, BLoC, etc.

Jan 2, 2023

App to showcase demo for how to have Clean Architecture in Flutter with Get_It for dependency injection

App to showcase demo for how to have Clean Architecture in Flutter with Get_It for dependency injection

App to showcase demo for how to have Clean Architecture in Flutter with Get_It for dependency injection, BLoC for state maintainence and Hive for persisting data into database.

Mar 19, 2022

🎬 Ditonton App is a Flutter application built to demonstrate the use of modern development tools with best practices implementation like Modularization, BLoC, Dependency Injection, Firebase Analytics & Crashlytics, Sqlite, Testing, CI/CD, etc.

🎬 Ditonton App is a Flutter application built to demonstrate the use of modern development tools with best practices implementation like Modularization, BLoC, Dependency Injection, Firebase Analytics & Crashlytics, Sqlite, Testing, CI/CD, etc.

Ditonton App Features Movies (Now Playing, Popular, Top Rated) TV Show (On The Air, Popular, Top Rated) Watchlist Movies & TV Show Search Movies & TV

Aug 12, 2023

Dependency Injection oversimplified. Inspired by Koin, with focus on scopes.

Dependency Injection oversimplified. Inspired by Koin, with focus on scopes. Features Define your dependencies in a syntax as close to DSL as possible

Dec 5, 2022

Clean Architecture + TDD + SOLID + Dependency Injection + GitFlow + Mobx

 Clean Architecture + TDD + SOLID + Dependency Injection + GitFlow + Mobx

Clean Architecture + TDD + SOLID + Dependency Injection + GitFlow + Mobx Flutter Interview Challenge This app is part of an interview process. It took

Dec 28, 2022

Simple and easy-to-use Dart wrapper for HackerEarth API (Compile & Run)

Simple and easy-to-use Dart wrapper for HackerEarth API (Compile & Run)

HackerEarth API Simple and easy-to-use Dart wrapper for HackerEarth API which provides endpoints for compiling and running code in several languages.

Dec 21, 2019

Magpie is a visualized platform which designed to create, develop and compile your standalone flutter module.

Magpie is a visualized platform which designed to create, develop and compile your standalone flutter module.

Magpie Workflow is a visualized platform which is designed to create, develop and compile your standalone flutter module;

Dec 4, 2022

Z time ago - A simple Flutter z time ago package used to change date to time ago for english, arabic and kurdish languages

This package is used to get time duration from now and given time for kurdish, a

May 19, 2022

The Dart Time Machine is a date and time library for Flutter, Web, and Server with support for timezones, calendars, cultures, formatting and parsing.

The Dart Time Machine is a date and time library for Flutter, Web, and Server with support for timezones, calendars, cultures, formatting and parsing.

The Dart Time Machine is a date and time library for Flutter, Web, and Server with support for timezones, calendars, cultures, formatting and parsing.

Oct 8, 2021

Provides Dart Build System builder for creating Injection pattern using annotations.

Provides Dart Build System builder for creating Injection pattern using annotations. Gate generator The core package providing generators using annoat

Dec 20, 2022

A CLI for syncing Dart dependency versions between pubspec.yaml and pubspec.lock files.

lockpick A CLI for syncing Dart dependency versions between pubspec.yaml and pubspec.lock files. 🔒 Usage # Activate lockpick pub global activate lock

Oct 17, 2022

A zero-dependency web framework for writing web apps in plain Dart.

Rad Rad is a frontend framework for creating fast and interactive web apps using Dart. It's inspired from Flutter and shares same programming paradigm

Dec 13, 2022

a sample flutter app using Injection, routing and simple authentication follows clean code and best practices

a sample flutter app using Injection, routing and simple authentication follows clean code and best practices

Flutter Clean Project A sample flutter app using Injection, routing and simple authentication follows clean code and best practices Features Cleaned f

Jan 2, 2023

his package provides a Clock class which encapsulates the notion of the "current time" and provides easy access to points relative to the current time.

This package provides a Clock class which encapsulates the notion of the "current time" and provides easy access to points relative to the current tim

Dec 15, 2022

A Funtioning basic Clock UI APP with extra functionalities such as displaying thecurrent time location being used and checking time for other timezones simultaneosly.

clock_UI A new Flutter project. Getting Started This project is a starting point for a Flutter application. A few resources to get you started if this

Dec 28, 2021

Simple project that consumes the World Time APi and displays the time for the chosen location.

Simple project that consumes the World Time APi and displays the time for the chosen location.

World Time App Simple project that consumes the World Time APi and displays the time for the chosen location. Web Api WorldTime Technologies Flutter A

Jan 20, 2022

Flutter-world-time-practice - World Time Tutorial App For Flutter

Flutter-world-time-practice - World Time Tutorial App For Flutter

world_time Result of Flutter Tutorial for Beginners Navigation: pushNamed, pop r

Feb 7, 2022
Comments
  • Naive conversion to work against dart2

    Naive conversion to work against dart2

    I'm sure that there is perhaps an internal version that has been updated (in a better capacity) to handle this package working with dart2. (This is simply applying naive changes which updates the type casting & json changes as well as dependencies).

    NOTE this breaks dart1, hence major version change (I recommend tagging beforehand as appropriate)

    opened by bjconlan 2
  • add .idea to .gitignore (#2)

    add .idea to .gitignore (#2)

    Add .idea to .gitignore file for development support in Intellij IDEA and Android Studio

    Resolve #2

    https://github.com/devlee-team/inject.dart/issues/2

    opened by devlee-team 2
  • Bumped up packages

    Bumped up packages

    Old package versions were not compatible with the new version of Flutter And I couldn't generate my inject files using this command

    flutter packages pub run build_runner build

    Now I can do it

    opened by lvlrSajjad 5
  • Create pubspec(updated).yaml

    Create pubspec(updated).yaml

    name: systranca_app description: A new Flutter project.

    The following defines the version and build number for your application.

    A version number is three numbers separated by dots, like 1.2.43

    followed by an optional build number separated by a +.

    Both the version and the builder number may be overridden in flutter

    build by specifying --build-name and --build-number, respectively.

    In Android, build-name is used as versionName while build-number used as versionCode.

    Read more about Android versioning at https://developer.android.com/studio/publish/versioning

    In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion.

    Read more about iOS versioning at

    https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html

    version: 1.0.0+1

    environment: sdk: ">=2.1.0 <3.0.0"

    dependencies: flutter: sdk: flutter http: flutter_dotenv: intl: easy_localization:

    The following adds the Cupertino Icons font to your application.

    Use with the CupertinoIcons class for iOS style icons.

    cupertino_icons: ^0.1.2

    dev_dependencies: flutter_test: sdk: flutter

    For information on the generic Dart part of this file, see the

    following page: https://www.dartlang.org/tools/pub/pubspec

    The following section is specific to Flutter.

    flutter:

    The following line ensures that the Material Icons font is

    included with your application, so that you can use the icons in

    the material Icons class.

    uses-material-design: true

    To add assets to your application, add an assets section, like this:

    assets: - assets/langs/ - .env - images/logo.png

    - images/a_dot_ham.jpeg

    An image asset can refer to one or more resolution-specific "variants", see

    https://flutter.io/assets-and-images/#resolution-aware.

    For details regarding adding assets from package dependencies, see

    https://flutter.io/assets-and-images/#from-packages

    To add custom fonts to your application, add a fonts section here,

    in this "flutter" section. Each entry in this list should have a

    "family" key with the font family name, and a "fonts" key with a

    list giving the asset and other descriptors for the font. For

    example:

    fonts:

    - family: Schyler

    fonts:

    - asset: fonts/Schyler-Regular.ttf

    - asset: fonts/Schyler-Italic.ttf

    style: italic

    - family: Trajan Pro

    fonts:

    - asset: fonts/TrajanPro.ttf

    - asset: fonts/TrajanPro_Bold.ttf

    weight: 700

    For details regarding fonts from package dependencies,

    see https://flutter.io/custom-fonts/#from-packages

    opened by Gandharvdalal 2
Owner
Google
Google ❤️ Open Source
Google
Implementation of the Flux framework for Flutter

flutter_flux A Dart app architecture library with uni-directional data flow inspired by RefluxJS and Facebook's Flux. This is an experimental package

Google 374 Dec 15, 2022
An assembled flutter application framework.

Fish Redux What is Fish Redux ? Fish Redux is an assembled flutter application framework based on Redux state management. It is suitable for building

Alibaba 7.3k Jan 7, 2023
Github Search - Flutter Modular example

Desafio Github Search Projeto desenvolvido no desafio quizenal realizado pela equipe Flutterando e comunidade. Foram realizadas adaptações para implem

Flutterando 24 Nov 6, 2021
Compile-time dependency injection for Dart and Flutter

package:inject Compile-time dependency injection for Dart and Flutter, similar to Dagger. NOTE: This is not an official Google or Dart team project. E

Google 863 Dec 31, 2022
A simple dependency injection plugin for Flutter and Dart.

A super simple dependency injection implementation for flutter that behaviours like any normal IOC container and does not rely on mirrors

Jon Samwell 91 Dec 13, 2022
A Dart dependency injection library aimed to be flexible, predictable and easy to use.

dino Dino is a Dart dependency injection library with optional code generation. It was inspired by DI in .NET and aimed to be flexible, predictable an

null 3 Dec 20, 2022
Toor makes service locators compile-time safe and easy to manage

?? What is Toor Toor makes service locators compile-time safe and easy to manage. ?? Getting Started Define your dependencies somewhere in the project

Arshak Aghakaryan 5 Jul 25, 2022
Flutter getx template - A Flutter Template using GetX package for State management, routing and Dependency Injection

Flutter GetX Template (GetX, Dio, MVVM) This Flutter Template using GetX package

Tareq Islam 6 Aug 27, 2022
Okan YILDIRIM 37 Jul 10, 2022
MVC pattern for flutter. Works as state management, dependency injection and service locator.

MVC pattern for flutter. Works as state management, dependency injection and service locator. Model View Controller Here's a diagram describing the fl

xamantra 115 Dec 12, 2022