wired 0.4.5

  • readme.md
  • CHANGELOG.md
  • Installing
  • Versions
  • 33

Wired

LOGO!

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

ApplicationContext.bootstrap();

To configure your classes make a configuration class

@Config
class SomeConfig {

  @Bean
  Counter counter() {
    return new Counter();
  }

  @Bean
  Calc calc() {
    return new Calc();
  }

}

When you want to access an instance you can call

ApplicationContext.getBean("counter");

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")
@Bean
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.

@Value("sentence")
String value;

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

ApplicationContext.getValue("sentence");

Order

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

@Config
@Order(2)
class ConfigComp { }

TODO

  • 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

1. Depend on it

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


dependencies:
  wired: "^0.4.5"

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:wired/wired.dart';
        
Version Uploaded Documentation Archive
0.4.5 Jun 3, 2016 Go to the documentation of wired 0.4.5 Download wired 0.4.5 archive
0.4.4 Dec 15, 2015 Go to the documentation of wired 0.4.4 Download wired 0.4.4 archive
0.4.3+1 Jan 22, 2015 Go to the documentation of wired 0.4.3+1 Download wired 0.4.3+1 archive
0.4.3 Jan 17, 2015 Go to the documentation of wired 0.4.3 Download wired 0.4.3 archive
0.4.2 Jan 16, 2015 Go to the documentation of wired 0.4.2 Download wired 0.4.2 archive
0.4.1 Jan 16, 2015 Go to the documentation of wired 0.4.1 Download wired 0.4.1 archive
0.4.0 Jan 8, 2015 Go to the documentation of wired 0.4.0 Download wired 0.4.0 archive
0.3.2+1 Oct 11, 2014 Go to the documentation of wired 0.3.2+1 Download wired 0.3.2+1 archive
0.3.2 Aug 31, 2014 Go to the documentation of wired 0.3.2 Download wired 0.3.2 archive

Analysis

We analyzed this package on Apr 23, 2018, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.0.0-dev.49.0
  • pana: 0.10.6

Scores

Popularity:
Describes how popular the package is relative to other packages. [more]
3 / 100
Health:
Code health derived from static analysis. [more]
98 / 100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
11 / 100
Overall score:
Weighted score of the above. [more]
33
Learn more about scoring.

Platforms

Detected platforms: web, other

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

Suggestions

  • The description is too short.

    Add more detail about the package, what it does and what is its target use case. Try to write at least 60 characters.

  • Package is pre-v1 release.

    While there is nothing inherently wrong with versions of 0.*.*, it usually means that the author is still experimenting with the general direction API.

  • Maintain an example.

    Create a short demo in the example/ directory to show how to use this package. Common file name patterns include: main.dart, example.dart or you could also use wired.dart.

  • Fix analysis and formatting issues.

    Analysis or formatting checks reported 4 hints.

    Run dartfmt to format lib/src/annotations/annotations.dart.

    Run dartfmt to format lib/src/di/bootstrap.dart.

    Similar analysis of the following files failed:

    • lib/src/di/messages_context.dart (hint)
    • lib/wired.dart (hint)

Dependencies

Package Constraint Resolved Available
Direct dependencies
mirrorme >=0.2.2 <0.3.0 0.2.2
yaml >=2.0.1+1 <3.0.0 2.1.13
Transitive dependencies
charcode 1.1.1
collection 1.14.9
path 1.5.1
source_span 1.4.0
string_scanner 1.0.2
Dev dependencies
unittest >=0.9.0 <0.9.1