{"id":32271826,"url":"https://github.com/karbunkul/flutter_any_to_widget","last_synced_at":"2025-10-22T22:58:40.838Z","repository":{"id":61975077,"uuid":"476025634","full_name":"karbunkul/flutter_any_to_widget","owner":"karbunkul","description":null,"archived":false,"fork":false,"pushed_at":"2022-04-07T08:28:55.000Z","size":171,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-10-22T22:58:40.468Z","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/karbunkul.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":"2022-03-30T19:35:46.000Z","updated_at":"2022-04-07T08:28:58.000Z","dependencies_parsed_at":"2022-10-24T13:45:46.654Z","dependency_job_id":null,"html_url":"https://github.com/karbunkul/flutter_any_to_widget","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/karbunkul/flutter_any_to_widget","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/karbunkul%2Fflutter_any_to_widget","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/karbunkul%2Fflutter_any_to_widget/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/karbunkul%2Fflutter_any_to_widget/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/karbunkul%2Fflutter_any_to_widget/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/karbunkul","download_url":"https://codeload.github.com/karbunkul/flutter_any_to_widget/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/karbunkul%2Fflutter_any_to_widget/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":280528622,"owners_count":26345643,"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-22T02:00:06.515Z","response_time":63,"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":[],"created_at":"2025-10-22T22:58:35.604Z","updated_at":"2025-10-22T22:58:40.833Z","avatar_url":"https://github.com/karbunkul.png","language":"Dart","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003c!-- \nThis README describes the package. If you publish this package to pub.dev,\nthis README's contents appear on the landing page for your package.\n\nFor information about how to write a good package README, see the guide for\n[writing package pages](https://dart.dev/guides/libraries/writing-package-pages). \n\nFor general information about developing packages, see the Dart guide for\n[creating packages](https://dart.dev/guides/libraries/create-library-packages)\nand the Flutter guide for\n[developing packages and plugins](https://flutter.dev/developing-packages). \n--\u003e\n\nConvert any data to widget\n\n## Getting started\n\nAdd package to your project ```flutter pub add any_to_widget```\n\nImplements DataConverter for your types. For example \n\n```dart\nimport 'package:any_to_widget/any_to_widget.dart';\nimport 'package:flutter/material.dart';\n\nclass A2WExceptionConverter implements DataConverter {\n  const A2WExceptionConverter();\n\n  @override\n  Widget convert(BuildContext context, data) {\n    final message =\n        (data as Exception).toString().replaceAll('Exception: ', '');\n    final style = Theme.of(context).textTheme.bodyText1;\n\n    return ListTile(\n      contentPadding: EdgeInsets.zero,\n      leading: const Icon(Icons.info, color: Colors.red),\n      title: Text('Error', style: style),\n      subtitle: Text(message),\n    );\n  }\n\n  @override\n  bool hasMatch(data) =\u003e data is Exception;\n}\n```\n\nSetup AnyToWidgetScope\n\n```dart\nimport 'package:any_to_widget/any_to_widget.dart';\nimport 'package:flutter/material.dart';\n\nclass MyApp extends StatelessWidget {\n  const MyApp({Key? key}) : super(key: key);\n\n  @override\n  Widget build(BuildContext context) {\n    return MaterialApp(\n      home: const HomePage(),\n      builder: (_, child) {\n        return AnyToWidgetScope(\n          converters: const [\n            A2WExceptionConverter(),\n          ],\n          child: child!,\n        );\n      },\n    );\n  }\n}\n```\n\nConvert any data to widget\n\n```dart\nimport 'package:any_to_widget/any_to_widget.dart';\nimport 'package:flutter/material.dart';\n\nclass HomePage extends StatelessWidget {\n  const HomePage({Key? key}) : super(key: key);\n\n  @override\n  Widget build(BuildContext context) {\n    return Scaffold(\n      appBar: AppBar(title: const Text('AnyToWidget Demo')),\n      body: Padding(\n        padding: const EdgeInsets.all(16.0),\n        child: Column(\n          crossAxisAlignment: CrossAxisAlignment.start,\n          children: [\n            AnyToWidget(Exception('Fatal Error')),\n            const SizedBox(height: 4),\n            const AnyToWidget(12.0),\n            const SizedBox(height: 4),\n            AnyToWidget(DateTime.now()),\n          ],\n        ),\n      ),\n    );\n  }\n}\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkarbunkul%2Fflutter_any_to_widget","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkarbunkul%2Fflutter_any_to_widget","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkarbunkul%2Fflutter_any_to_widget/lists"}