proxiable 0.0.1 copy "proxiable: ^0.0.1" to clipboard
proxiable: ^0.0.1 copied to clipboard

discontinued
outdated

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.

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

You do NOT need to initialize reflectable.

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

class Animal {
  void walk() {
    print("Animal is waling.");
  }
}

void main() {
  Animal animal = Proxiable(
    Animal,
    DefaultInvocationHandler(Animal()),
  );
  animal.walk(); // print: Animal is waling.
}
1
likes
0
pub points
0%
popularity

Publisher

unverified uploader

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.

Repository (GitHub)
View/report issues

License

unknown (LICENSE)

Dependencies

analyzer, build, build_config, glob, mustache, reflectable, source_gen

More

Packages that depend on proxiable