{"id":20609503,"url":"https://github.com/fluttercommunity/dart_sealed_unions","last_synced_at":"2025-07-06T17:04:50.036Z","repository":{"id":40523344,"uuid":"116267531","full_name":"fluttercommunity/dart_sealed_unions","owner":"fluttercommunity","description":"Sealed Unions for Dart. Maintainer: @nodinosaur","archived":false,"fork":false,"pushed_at":"2021-03-18T08:52:19.000Z","size":140,"stargazers_count":66,"open_issues_count":2,"forks_count":7,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-06-02T10:44:49.478Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://pub.dev/packages/sealed_unions","language":"Dart","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/fluttercommunity.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-01-04T14:12:39.000Z","updated_at":"2024-03-26T20:08:35.000Z","dependencies_parsed_at":"2022-06-27T18:01:45.023Z","dependency_job_id":null,"html_url":"https://github.com/fluttercommunity/dart_sealed_unions","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/fluttercommunity/dart_sealed_unions","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fluttercommunity%2Fdart_sealed_unions","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fluttercommunity%2Fdart_sealed_unions/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fluttercommunity%2Fdart_sealed_unions/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fluttercommunity%2Fdart_sealed_unions/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fluttercommunity","download_url":"https://codeload.github.com/fluttercommunity/dart_sealed_unions/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fluttercommunity%2Fdart_sealed_unions/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":263940256,"owners_count":23533008,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-16T10:13:44.496Z","updated_at":"2025-07-06T17:04:49.985Z","avatar_url":"https://github.com/fluttercommunity.png","language":"Dart","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Flutter Community: sealed_unions](https://fluttercommunity.dev/_github/header/sealed_unions)](https://github.com/fluttercommunity/community)\n\n## ACKNOWLEDGEMENTS\nThis library is a port of [JavaSealedUnions](https://github.com/pakoito/JavaSealedUnions/blob/master/README.md) originally created by [Francisco](https://github.com/pakoito/) ([Paco](https://github.com/pakoito/)) [Estévez\n](https://github.com/pakoito/).\n\n`Dart` port by [George Medve](https://github.com/nodinosaur) with assistance from [Jan Knotek](https://github.com/JanKn) and [Brian Egan](https://github.com/brianegan).\n\n## RATIONALE\nSealed classes are used for representing restricted class hierarchies, when a value can have one of the types from a limited set, but cannot have any other type. They are, in a sense, an extension of enum classes: the set of values for an enum type is also restricted, but each enum constant exists only as a single instance, whereas a subclass of a sealed class can have multiple instances which can contain state.\nSealed classes are available in languages like [Kotlin](https://kotlinlang.org/docs/reference/classes.html#sealed-classes), or [C#](https://msdn.microsoft.com/en-gb/library/88c54tsw.aspx). Tagged unions are common on [Swift](https://developer.apple.com/library/ios/documentation/Swift/Conceptual/Swift_Programming_Language/Enumerations.html) and [Rust](https://doc.rust-lang.org/book/enums.html).\n\nWe highly recommend reading the [Rationale](https://github.com/pakoito/JavaSealedUnions/blob/master/README.md#rationale) for the readme of [JavaSealedUnions](https://github.com/pakoito/JavaSealedUnions/blob/master/README.md) for an indepth explanation of the idea and application of the library.\n\n## MOTIVATION\nThis library was heavily inspired by [RxEither](https://github.com/eleventigers/rxeither) and the wonderful [Domain Driven Design](https://fsharpforfunandprofit.com/ddd/) (DDD) talk by [Scott Wlaschin](https://github.com/swlaschin).\nThis video by Scott Wlaschin will inspire you on how to apply DDD:\n[Domain Driven Design, F# and Types](https://skillsmatter.com/skillscasts/4971-domain-driven-design-with-scott-wlaschin)\n\n## USAGE\nThe following example project: [MVI Sealed Unions](https://github.com/fluttercommunity/mvi_sealed_unions) demonstrates the library application in a Flutter app.\n\n## INSTALLING\n#### 1. Depend on it\nAdd this to your package's `pubspec.yaml` file:\n\n```yaml\ndependencies:\n  sealed_unions: \"^3.0.3+1\"\n```\n\n#### 2.Install it\nYou can install packages from the command line:\n\nwith Flutter:\n```bash\nflutter packages get\n```\n\nwith pub:\n```bash\npub get\n```\n\n#### 3. Import it\nNow in your Dart code, you can use:\n```dart\n// for example import Union4\nimport 'package:sealed_unions/union_4.dart';\n```\n\n# License\nCopyright (c) fluttercommunity 2019\n\nThe Apache Software License, Version 2.0\n\nSee LICENSE.md\n\n[![Flutter Community: sealed_unions](https://fluttercommunity.dev/_github/header/sealed_unions)](https://github.com/fluttercommunity/community)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffluttercommunity%2Fdart_sealed_unions","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffluttercommunity%2Fdart_sealed_unions","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffluttercommunity%2Fdart_sealed_unions/lists"}