proxiable 0.3.0

  • Readme
  • Changelog
  • Example
  • Installing
  • new45

Proxiable #

Proxy provides static methods for creating dynamic proxy classes and instances, and it is also the superclass of all dynamic proxy classes created by those methods.

Read More #

Java Proxy Class

Provided Features #

Proxy.newProxyInstance: creates proxy instance, slightly different from java Proxy.

InvocationHandler: contract that your handler should implements;

DefaultInvocationHandler: it calls original method, getter or setter.

Usage #

1. Initialization in main.dart

You do NOT need to initialize reflectable.

// file: main.dart
import "main.proxiable.dart";

void main() {
  initializeProxiable();
}

2. Create and use Proxied instance #

// file: main.dart
import "package:proxiable/proxiable.dart";

// mark the class with @proxiable is required
@proxiable
class Animal {
  void walk() {
    print("Animal is waling.");
  }
}

void main() {
  Animal animal = Proxiable(
    Animal,
    DefaultInvocationHandler(Animal()),
  );
  animal.walk(); // print: Animal is waling.
}

1.0.0 #

  • Initial version, created by Stagehand

example/example.dart

import 'package:proxiable/src/annotation/enable_proxable.dart';
import 'package:proxiable/src/annotation/proxiable.dart';

@Proxiable()
class Hunter {}

@EnableProxiable()
class Entry {}

void main() {}

Use this package as a library

1. Depend on it

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


dependencies:
  proxiable: ^0.3.0

2. Install it

You can install packages from the command line:

with pub:


$ pub get

with Flutter:


$ flutter pub get

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

3. Import it

Now in your Dart code, you can use:


import 'package:proxiable/proxiable.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
0
Health:
Code health derived from static analysis. [more]
98
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
80
Overall:
Weighted score of the above. [more]
45
Learn more about scoring.

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

  • Dart: 2.6.0
  • pana: 0.12.21

Platforms

Detected platforms: Flutter, web, other

No platform restriction found in primary library package:proxiable/proxiable.dart.

Health issues and suggestions

Document public APIs. (-1 points)

31 out of 31 API elements have no dartdoc comment.Providing good documentation for libraries, classes, functions, and other API elements improves code readability and helps developers find and use your API.

Fix lib/src/runtime/proxy.dart. (-1 points)

Analysis of lib/src/runtime/proxy.dart reported 2 hints:

line 1 col 8: Unused import: 'package:proxiable/src/annotation/proxiable.dart'.

line 5 col 8: Unused import: 'package:reflectable/mirrors.dart'.

Maintenance issues and suggestions

Use constrained dependencies. (-20 points)

The pubspec.yaml contains 6 dependencies without version constraints. Specify version ranges for the following dependencies: analyzer, build, build_config, glob, reflectable, source_gen.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.4.0 <3.0.0
analyzer any 0.38.5 0.39.1
build any 1.2.1
build_config >=0.3.0 0.4.1+1
glob any 1.2.0
mustache 1.1.1 1.1.1
reflectable any 2.2.0
source_gen >=0.8.0 0.9.4+6
Transitive dependencies
analyzer_plugin 0.2.1
args 1.5.2
async 2.4.0
build_daemon 2.1.0
build_resolvers 1.2.1 1.2.2
build_runner_core 4.1.0
built_collection 4.2.2
built_value 6.8.2 7.0.0
built_value_generator 6.8.2 7.0.0
charcode 1.1.2
checked_yaml 1.0.2
code_builder 3.2.0
collection 1.14.12
convert 2.1.1
crypto 2.1.3
csslib 0.16.1
dart_style 1.3.3
fixnum 0.10.11
front_end 0.1.27 0.1.29
graphs 0.2.0
html 0.14.0+3
http 0.12.0+2
http_multi_server 2.1.0
http_parser 3.1.3
io 0.3.3
js 0.6.1+1
json_annotation 3.0.0
kernel 0.3.27 0.3.29
logging 0.11.3+2
matcher 0.12.6
meta 1.1.8
mime 0.9.6+3
node_interop 1.0.3
node_io 1.0.1+2
package_config 1.1.0
package_resolver 1.0.10
path 1.6.4
pool 1.4.0
pub_semver 1.4.2
pubspec_parse 0.1.5
quiver 2.1.2+1
shelf 0.7.5
shelf_web_socket 0.2.3
source_span 1.5.5
stack_trace 1.9.3
stream_channel 2.0.0
stream_transform 0.0.20
string_scanner 1.0.5
term_glyph 1.1.0
timing 0.1.1+2
typed_data 1.1.6
watcher 0.9.7+12
web_socket_channel 1.1.0
yaml 2.2.0
Dev dependencies
build_runner any 1.7.2
pedantic ^1.7.0 1.8.0+1
test ^1.6.0