mirrorme2 0.1.0

Mirror me #

A mirrors helper library for the dart language.

Walkthrough #

This is how you can scrap the metadata info from an object.

MetaDataHelper<MetaData, MethodMirror> mirrorHelper = new MetaDataHelper<MetaData, MethodMirror>();
List<MetaDataValue<MetaData>> mirrorModels = mirrorHelper.from(new Anno());

The annotated class.

class Anno {

  @MetaData("test")
  void test() {}
  
}

MetaDataValue has the following fields:

Symbol memberName;
InstanceMirror instanceMirror;
T object;

Search for classes that implement or extend for example the class Anno.

ClassSearcher<Anno> searcher = new ClassSearcher<Anno>();
List<Anno> searchResult = searcher.scan();

Notes to Contributors #

Fork Mirrorme #

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.

For usage see Dart Force #

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

Changelog #

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

Pub version 0.2.2 #

renaming to mirrorme

Pub version 0.2.1+1 - 0.2.1+5 #

add a method on MetadataValue to get the return type typeOfOwner

Pub version 0.2.1 #

extends the MetaDataHelper with method fromMirror, so we can look at it without instantiating it.

Pub version 0.2.0 #

add iml to gitignore Rename AnnotationChecker to AnnotationScanner Scan All libraries instead of just RootLibrary Add Documentation

Pub version 0.1.11 #

Change logic of annotation_checker and class_scanner to reduce size.

Pub version 0.1.10+3 #

Skip dart core libraries to scan for annotations.

Pub version 0.1.10 & 0.1.10+1 & 0.1.10+2

Add method 'getOtherMetadata' in the class 'MetaDataValue'.

Pub version 0.1.9 #

Extend MetaDataHelper so it can search for methods and variables.

Pub version 0.1.8 #

Adding name to get the string name out of the mirrors in the class 'MetaDataValue'.

Pub version 0.1.8 #

Adding functionality to check if a annotation is available on a class.

Pub version 0.1.7 #

Provide methodMirror in MetaDataValue and added a property to access parameters.

Pub version 0.1.6+2 #

Adding dev dependencies for unittests.

Pub version 0.1.6+1 #

Creating the correct instance of the correct class in class searcher.

Pub version 0.1.6 #

Adding a way to search for class that implements or extends a certain class with mirror operations.

Pub version 0.1.5 #

Solving a bug in metadata helpers to return a value.

Pub version 0.1.5 #

Adding a class scanner to get a list of all classes with a certain annotation.

Pub version 0.1.4 & 0.1.4+1

Adding invoke method to force metadata value.

Pub version 0.1.3 & 0.1.3+1

Adding some minor changes.

Pub version 0.1.2+1 #

Adding tests for mirrorhelpers and classes for annotation handling.

Use this package as a library

1. Depend on it

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


dependencies:
  mirrorme2: ^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:mirrorme2/mirrorme2.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
1
Health:
Code health derived from static analysis. [more]
93
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
90
Overall:
Weighted score of the above. [more]
46
Learn more about scoring.

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

  • Dart: 2.5.0
  • pana: 0.12.21

Platforms

Detected platforms: web, other

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

Health suggestions

Fix lib/helpers/metadata_value.dart. (-2.96 points)

Analysis of lib/helpers/metadata_value.dart reported 6 hints, including:

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

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

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

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

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

Fix lib/helpers/metadata_helpers.dart. (-1.99 points)

Analysis of lib/helpers/metadata_helpers.dart reported 4 hints:

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

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

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

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

Fix lib/helpers/annotation_checker.dart. (-1.49 points)

Analysis of lib/helpers/annotation_checker.dart reported 3 hints:

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

line 11 col 4: Prefer using /// for doc comments.

line 16 col 8: DO use curly braces for all flow control structures.

Fix additional 3 files with analysis or formatting issues. (-1 points)

Additional issues in the following files:

  • lib/helpers/class_scanner.dart (1 hint)
  • lib/helpers/class_searcher.dart (1 hint)
  • lib/mirrorme2.dart (Run dartfmt to format lib/mirrorme2.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 mirrorme2.dart. Packages with multiple examples should provide example/README.md.

For more information see the pub package layout conventions.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0 <3.0.0
Dev dependencies
test ^1.0.0