{"id":23787672,"url":"https://github.com/unacorbatanegra/tie_fp","last_synced_at":"2026-04-20T19:03:37.304Z","repository":{"id":176965009,"uuid":"656850746","full_name":"unacorbatanegra/tie_fp","owner":"unacorbatanegra","description":"FP opinionated in Flutter \u0026 Dart","archived":false,"fork":false,"pushed_at":"2024-08-13T19:38:53.000Z","size":6802,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-10-14T07:37:29.887Z","etag":null,"topics":["dart","error-handling","flutter","functional","functional-programming","futures","result"],"latest_commit_sha":null,"homepage":"https://pub.dev/packages/tie_fp","language":"Dart","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/unacorbatanegra.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-06-21T19:17:25.000Z","updated_at":"2024-08-13T19:38:56.000Z","dependencies_parsed_at":null,"dependency_job_id":"ef874712-327a-4fba-aa0d-d20850b6cbc7","html_url":"https://github.com/unacorbatanegra/tie_fp","commit_stats":null,"previous_names":["unacorbatanegra/tie_fp"],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/unacorbatanegra/tie_fp","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/unacorbatanegra%2Ftie_fp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/unacorbatanegra%2Ftie_fp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/unacorbatanegra%2Ftie_fp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/unacorbatanegra%2Ftie_fp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/unacorbatanegra","download_url":"https://codeload.github.com/unacorbatanegra/tie_fp/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/unacorbatanegra%2Ftie_fp/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279018221,"owners_count":26086307,"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","status":"online","status_checked_at":"2025-10-14T02:00:06.444Z","response_time":60,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["dart","error-handling","flutter","functional","functional-programming","futures","result"],"created_at":"2025-01-01T15:15:49.416Z","updated_at":"2025-10-14T07:37:31.494Z","avatar_url":"https://github.com/unacorbatanegra.png","language":"Dart","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Pub Package](https://img.shields.io/pub/v/tie_fp.svg)](https://pub.dev/packages/tie_fp)\n\n# Tie FP\n\nA simple package that provides a class `Result` along with its subclasses `Success` and `Failure`. This package is designed to handle success and failure scenarios in a concise and type-safe manner.\n\nThis package is inspired but not based in:\n\n- [Result - Rust](https://doc.rust-lang.org/std/result/)\n- [Error - Go](https://go.dev/blog/error-handling-and-go)\n- [Abseil Status - C++](https://abseil.io/docs/cpp/guides/status)\n\n## Fundamentals\n\nAll `Functions` and `Futures` are error-prone making it difficult to make sure if anything went wrong without writing a lot of boilerplate with the try-catch scenarios.\n\nThe `Result` class tries to avoid these by using extensions and wrapping everything giving you only a `isError()` method to make sure the result of the computation, and avoiding the rethrow step.\n\nIf you need to perform operations that potentially throw an error you can do this:\n\n```dart\n\nResult\u003cvoid\u003e myFunction(){\n\n  try {\n    operation1();\n    operation2();\n    return Success(null);\n  } catch(Exception exception, StackTrace stackTrace){\n    return Failure(exception,stackTrace);\n  }\n}\n\nvoid main(){\n\n  final result= myFunction();\n  if(result.isError()){\n    /// perform something\n    return;\n  }\n\n}\n```\n\nIf you want to wrap a `Function` you can do this:\n\n```dart\nint operation() =\u003e 1;\n\nvoid main(){\n  Result\u003cint\u003e result = Result.wrapFunction(operation());\n}\n```\n\nwhich is the equivalent of\n\n```dart\ntry{\n  final v=operation();\n  return Success(v);\n} catch(Exception exception, StackTrace stackTrace){\n  return Failure(exception,stackTrace);\n}\n\n```\n\nIn the case of a `Future` the `toResult()` method is useful:\n\n```dart\n@override\nFuture\u003cResult\u003cRide\u003e\u003e detailed(int id) =\u003e supabase\n    .from(table)\n    .select(\"*, user:profiles(*), vehicle(*) \")\n    .eq('id', id)\n    .limit(1)\n    .single()\n    .then((value) =\u003e Ride.fromMap(value))\n    .toResult();\n```\n\n## Conclusion\n\nThe `Result` package simplifies the handling of success and failure scenarios by providing a sealed class that encapsulates the result and error information. It enables you to write cleaner and more robust code when dealing with operations that can succeed or fail.\n\nWe hope you find this package useful in your Dart projects! If you have any questions or feedback, please don't hesitate to reach out.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Funacorbatanegra%2Ftie_fp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Funacorbatanegra%2Ftie_fp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Funacorbatanegra%2Ftie_fp/lists"}