NewYour coding agent can read the release notes before it upgrades.Set up the MCP server →
pub.dev
Dart macros for algebraic types
Last release 2 years ago
no release in 18 months
Too new to tell
only 1 release windows
Rarely documented
notes for 1 of 5 stable releases
Nothing withdrawn
no release was ever pulled
2 years old
5 releases · first in 2024
One column per month.
<div class="highlight highlight-source-dart notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="import 'package:algebrai
Enum type
import 'package:algebraic_types/algebraic_types.dart';
import 'package:json/json.dart';
void main() {
var w = W.Variant1(C(2));
w = W.fromJson(w.toJson());
assert(w is W$Variant1);
print(w.toJson()); // {"Variant1": {"x": 2}}
w = W.Variant2(C(1), B("hello"));
w = W.fromJson(w.toJson());
assert(w is W$Variant2);
print(w.toJson()); // {"Variant2": [{"x": 1}, {"x": hello}]}
w = W.Variant3();
assert(w is W$Variant3);
print(w.toJson()); // {"Variant3": null}
switch (w) {
case W$Variant1(:final v1):
print("Variant1");
case W$Variant2(:final v1, :final v2):
print("Variant2");
case W$Variant3():
print("Variant3");
}
}
@JsonCodable()
class C {
int x;
C(this.x);
}
@JsonCodable()
class B {
String x;
B(this.x);
}
// or just `@Enum` if you don't want json
@EnumSerde(
"Variant1(C)",
"Variant2(C,B)",
"Variant3"
)
class _W {}Full Changelog: https://github.com/mcmah309/algebraic_types/commits/v0.0.5
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Your coding agent can read these notes before it upgrades. Set up the MCP server →