Skip to content

CAPHTECH/dart_multimethod

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.1

Import

import 'package:dart_multimethod/dart_multimethod.dart';

Usage

Basic usage

import 'package:dart_multimethod/dart_multimethod.dart';

final area = Multimethod<MyClass, String>((o) => o.name).when('first', (o) => '${o.name} square');
print(area(MyClass('first')));  // first square