wired2 0.1.0

  • Readme
  • Changelog
  • Installing
  • 46

Wired #


Part of the Dart Force Framework.

A library to do dependency injection! It uses the same annotations as in java spring applications.

Walkthrough #

To bootstrap your injections call


To configure your classes make a configuration class

class SomeConfig {

  Counter counter() {
    return new Counter();

  Calc calc() {
    return new Calc();


When you want to access an instance you can call


You can also define Components by using the @Component annotation

For the moment we only support set dependency injections and not constructor dependency injection.

Qualifier #

You can use a Qualifier to give the bean a specific name, it is usefull when you want to configure 2 instances of the same class.

@Qualifier(name: "firstCounter")
Calc calc() {
	return new Calc();

Values #

You can add yaml values into your classes. First add them to the applicationContext. The first value is the key of the messages and the second value is the yaml content.

ApplicationContext.registerMessage("sentences", "sentence: Is this good?");

Register the messages before calling the method bootstrap of ApplicationContext.

You can add the @Value annotation into a scanned bean.

String value;

You can also get a value from ApplicationContext, like follow:


Order #

With the @order annotation we can set the order of a configuration class.

class ConfigComp { }


  • add posibility to add @Autowired in constructor values

Notes to Contributors #

Fork Wired #

If you'd like to contribute back to the core, you can fork this repository and send us a pull request, when it is ready.

If you are new to Git or GitHub, please read this guide first.

Dart Force #

Realtime web framework for dart that uses forcemvc & forcemirrors & wired source code

Twitter #

Follow us on twitter https://twitter.com/usethedartforce

Google+ #

Follow us on google+

Changelog #

This file contains highlights of what changes on each version of the wired package.

Pub version 0.4.5 #

  • @Value annotations can now be any valid YAML value

Pub version 0.4.4 #

  • At annotation @order into the library, @order helps you to order the configuration classes.

Pub version 0.4.3+1 #

  • look at interfaces on all levels (getBeanByType)

Pub version 0.4.3 #

  • getBeanByType, also look at his interfaces!

Pub version 0.4.2 #

Fix issue with getBeanByType, when more beans are in the pool, adapt tests

Pub version 0.4.1 #

Adapting getBeanByType so it will accept also and can work with subclasses and superclasses

Pub version 0.4.0 #

Adding setBean method in ApplicationContext Update dependencies to mirrorme (renaming forcemirrors) this is not bc

Pub version 0.3.2+1 #

Update YAML dependency.

Pub version 0.3.2 #

Add static method getBeanByType on ApplicationContext Also resolve autowired cases by Type and not only by name Rename package to 'wired'

Pub version 0.3.1 #

Improved the addComponents method

Pub version 0.3.0 #

Add documentation Change component(Scanner scanner) to addComponents(Iterable objs) Change MetaDataHelper().getVariableMirrorValues(obj) to MetaDataHelper<_Autowired, VariableMirror>().from(obj) Change MetaDataHelper().getMirrorValues(obj) to MetaDataHelper<_Bean, MethodMirror>().from(obj)

Pub version 0.2.1+1 #

Moving repo to ForceUniverse organisation

Pub version 0.2.1 #

Fix scanning of config classes and component classes.

Pub version 0.2.0 #

Remove parentheses from annotations.

Pub version 0.1.3+2 #

Yaml value can be anything! Change the return type to dynamic to get a value!

Pub version 0.1.3+1 #

Adding a method to get a value from a yaml file through ApplicationContext.

Pub version 0.1.3 #

Now you can inject yaml values into your dart classes.

Pub version 0.1.2 #

Adding the Qualifier annotation to this package, so you can name the beans you configure.

Pub version 0.1.1 & 0.1.1+1

Make it possible to switch order of the classes when they are created!

Pub version 0.1.0+1 #

Adding documentation

Pub version 0.1.0 #

Initial setup of the package

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:

  wired2: ^0.1.0

2. Install it

You can install packages from the command line:

with pub:

$ pub get

Alternatively, your editor might support pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:

import 'package:wired2/wired2.dart';
Describes how popular the package is relative to other packages. [more]
Code health derived from static analysis. [more]
Reflects how tidy and up-to-date the package is. [more]
Weighted score of the above. [more]
Learn more about scoring.

We analyzed this package on Oct 11, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.5.1
  • pana: 0.12.21


Detected platforms: web, other

Primary library: package:wired2/wired2.dart with components: mirrors.

Health suggestions

Fix lib/src/di/bootstrap.dart. (-5.84 points)

Analysis of lib/src/di/bootstrap.dart reported 12 hints, including:

line 2 col 1: Prefer using /// for doc comments.

line 15 col 3: Prefer using /// for doc comments.

line 45 col 3: Prefer using /// for doc comments.

line 60 col 3: Prefer using /// for doc comments.

line 65 col 3: Prefer using /// for doc comments.

Fix lib/src/annotations/annotations.dart. (-0.50 points)

Analysis of lib/src/annotations/annotations.dart reported 1 hint:

line 57 col 44: Use = to separate a named parameter from its default value.

Fix lib/src/di/messages_context.dart. (-0.50 points)

Analysis of lib/src/di/messages_context.dart reported 1 hint:

line 15 col 44: Use = to separate a named parameter from its default value.

Format lib/wired2.dart.

Run dartfmt to format lib/wired2.dart.

Maintenance suggestions

Maintain an example. (-10 points)

Create a short demo in the example/ directory to show how to use this package.

Common filename patterns include main.dart, example.dart, and wired2.dart. Packages with multiple examples should provide example/README.md.

For more information see the pub package layout conventions.


Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0 <3.0.0
mirrorme2 ^0.1.0 0.1.0
path ^1.6.2 1.6.4
yaml >=2.0.1+1 <3.0.0 2.2.0
Transitive dependencies
charcode 1.1.2
collection 1.14.12
meta 1.1.7
source_span 1.5.5
string_scanner 1.0.5
term_glyph 1.1.0
Dev dependencies
test ^1.0.0