{"id":18508527,"url":"https://github.com/roundedinfinity/platform_specific","last_synced_at":"2025-10-29T01:42:42.644Z","repository":{"id":170673057,"uuid":"646882662","full_name":"RoundedInfinity/platform_specific","owner":"RoundedInfinity","description":"Dart package that simplifies handling platform-specific operations and callbacks in your Dart/Flutter applications.","archived":false,"fork":false,"pushed_at":"2023-10-04T01:18:26.000Z","size":31,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-05-14T09:51:36.784Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/RoundedInfinity.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-05-29T14:54:26.000Z","updated_at":"2023-05-29T14:54:34.000Z","dependencies_parsed_at":null,"dependency_job_id":"926b9646-2536-406e-bae9-5d607b84e7fb","html_url":"https://github.com/RoundedInfinity/platform_specific","commit_stats":null,"previous_names":["roundedinfinity/platform_specific"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/RoundedInfinity/platform_specific","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RoundedInfinity%2Fplatform_specific","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RoundedInfinity%2Fplatform_specific/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RoundedInfinity%2Fplatform_specific/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RoundedInfinity%2Fplatform_specific/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/RoundedInfinity","download_url":"https://codeload.github.com/RoundedInfinity/platform_specific/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RoundedInfinity%2Fplatform_specific/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265508150,"owners_count":23779084,"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-06T15:14:38.930Z","updated_at":"2025-10-29T01:42:42.544Z","avatar_url":"https://github.com/RoundedInfinity.png","language":"Dart","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Platform Specific\n\n[![style: very good analysis][very_good_analysis_badge]][very_good_analysis_link]\n[![Powered by Mason](https://img.shields.io/endpoint?url=https%3A%2F%2Ftinyurl.com%2Fmason-badge)](https://github.com/felangel/mason)\n[![License: MIT][license_badge]][license_link]\n\nDart package that simplifies handling platform-specific operations and callbacks in your Dart/Flutter applications.\n\n## Features 🚀\n\n- Execute platform-specific callback functions based on the detected platform type.\n- Define custom platform types to handle specific platforms.\n- Supports a wide range of platforms out of the box including web, Windows, Linux, Android, macOS, Fuchsia, and iOS.\n\n## Usage 🧪\n\nUse the `Platforms.on` method to execute the appropriate callback function based on the platform:\n\n```dart\nfinal myValue = Platforms.on\u003cString\u003e(\n  {\n    PlatformTypes.android: () {\n      return '🤖';\n    },\n    PlatformTypes.windows: () {\n      return '🪟';\n    },\n    PlatformTypes.oneOf([PlatformTypes.iOS, PlatformTypes.macOS]): () {\n      return '🍎';\n    }\n  },\n  orElse: () {\n    return 'unknown';\n  },\n);\n\nprint(myValue); // Output: 🍎 (if running on iOS or macOS), 🤖 (if running on Android), 🪟 (if running on Windows), or 'unknown' (if running on any other platform)\n\n```\n\n### Custom Platform Types\n\nYou can create custom platform types by extending the `PlatformType` class and overriding the `isPlatform` method. This allows you to handle additional platforms not covered by the predefined types.\n\n```dart\nclass MyCustomPlatform extends PlatformType {\n  const MyCustomPlatform();\n\n  @override\n  bool isPlatform(PlatformType? override) {\n    // Add your custom platform detection logic here\n    // Should return true if override == this\n    ...\n  }\n}\n```\n\n[license_badge]: https://img.shields.io/badge/license-MIT-blue.svg\n[license_link]: https://opensource.org/licenses/MIT\n[very_good_analysis_badge]: https://img.shields.io/badge/style-very_good_analysis-B22C89.svg\n[very_good_analysis_link]: https://pub.dev/packages/very_good_analysis\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Froundedinfinity%2Fplatform_specific","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Froundedinfinity%2Fplatform_specific","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Froundedinfinity%2Fplatform_specific/lists"}