dart_multimethod 0.0.2 dart_multimethod: ^0.0.2 copied to clipboard
dart_multimethod is a library for implementing multimethods in Dart.
dart_multimethod #
dart_multimethod is a package that provides multimethods for Dart.
Features #
- multimethod functions
Getting started #
Installation #
Add dart_multimethod
to your pubspec.yaml
file:
dependencies:
dart_multimethod: ^0.0.2
Import #
import 'package:dart_multimethod/dart_multimethod.dart';
Usage #
Basic usage #
import 'package:dart_multimethod/dart_multimethod.dart';
final area = Multimethod<String, MyClass, String>((o) => o.name).when('first', (o) => '${o.name} square');
print(area(MyClass('first'))); // first square