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

Annotations for the operator code-generator. This package does nothing without operator too.

  • Usage
import 'package:operator_annotation/operator_annotation.dart';

part 'test.operator.dart';

@operator
class A {
  final int a;
  A(this.a);
}
//////
part of 'test.dart';

extension AX on A {
  dynamic operator [](String prop) {
    final func = map[prop];
    if (func == null) {
      throw ArgumentError('Property `$prop` does not exist on ItemClass.');
    }
    return func.call(this);
  }

  static Map<String, Function(A)> map = {'a': (A ins) => ins.a};
}

0
likes
120
points
27
downloads

Publisher

unverified uploader

Weekly Downloads

Annotations for the operator code-generator. This package does nothing without operator too.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

meta

More

Packages that depend on operator_annotation