{"id":26457182,"url":"https://github.com/terran-source/dart-interpolation","last_synced_at":"2025-03-18T22:43:38.713Z","repository":{"id":53723668,"uuid":"252760852","full_name":"Terran-Source/dart-interpolation","owner":"Terran-Source","description":"A Dart package to handle dynamic String \u0026 Json interpolation.","archived":false,"fork":false,"pushed_at":"2021-09-14T09:49:15.000Z","size":99,"stargazers_count":8,"open_issues_count":1,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-10-31T21:36:17.547Z","etag":null,"topics":["dart","flutter","interpolate","interpolation","json-interpolation"],"latest_commit_sha":null,"homepage":"https://pub.dev/packages/interpolation","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/Terran-Source.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":".github/CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":".github/CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-04-03T14:47:31.000Z","updated_at":"2023-09-28T19:03:32.000Z","dependencies_parsed_at":"2022-09-10T12:01:51.022Z","dependency_job_id":null,"html_url":"https://github.com/Terran-Source/dart-interpolation","commit_stats":null,"previous_names":[],"tags_count":14,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Terran-Source%2Fdart-interpolation","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Terran-Source%2Fdart-interpolation/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Terran-Source%2Fdart-interpolation/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Terran-Source%2Fdart-interpolation/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Terran-Source","download_url":"https://codeload.github.com/Terran-Source/dart-interpolation/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244320333,"owners_count":20434092,"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":["dart","flutter","interpolate","interpolation","json-interpolation"],"created_at":"2025-03-18T22:43:38.203Z","updated_at":"2025-03-18T22:43:38.701Z","avatar_url":"https://github.com/Terran-Source.png","language":"Dart","funding_links":[],"categories":[],"sub_categories":[],"readme":"# interpolation [![Pub version](https://img.shields.io/pub/v/interpolation.svg?style=plastic)](https://pub.dev/packages/extend) [![GitHub](https://img.shields.io/github/license/Terran-Source/dart-interpolation?logo=github\u0026style=plastic)](LICENSE)\n\nA Dart package to handle dynamic String \u0026 Json interpolation.\n\n## Usage\nA simple usage example:\n\n#### Add the dependency in pubspec.yaml\n```yaml\n# pubspec.yaml\n# add dependencies\ndependencies:\n  interpolation: \u003clatest-version\u003e\n\n```\n\n#### Now the code\n```dart\nimport 'package:interpolation/interpolation.dart';\n\nvoid main() {\n  var interpolation = Interpolation();\n  var str =\n      \"Hi, my name is '{name}'. I'm {age}. I am {education.degree} {education.profession}.\";\n\n  print(interpolation.eval(str, {\n    'name': 'David',\n    'age': 29,\n    'education': {'degree': 'M.B.B.S', 'profession': 'Doctor'}\n  }));\n  // output: Hi, my name is 'David'. I'm 29. I am M.B.B.S Doctor.\n\n  var obj = {\n    'a': 'a',\n    'b': 10,\n    'c': {\n      'd': 'd',\n      'e': 'Hello {c.d}',\n      'f': 'Hi \"{a}\", am I deep enough, or need to show \"{c.e}\" with {b}'\n    }\n  };\n\n  // traverse the object\n  print(interpolation.traverse(obj, 'b'));\n  // output: 10\n  print(interpolation.traverse(obj, 'c.e'));\n  // output: Hello {c.d}\n  print(interpolation.traverse(obj, 'c.g')); // not present\n  // output: (empty string)\n  print(interpolation.traverse(obj, 'c.g', true)); // not present but keepAlive\n  // output: {c.g}\n\n  // resolve the object\n  print(interpolation.resolve(obj));\n  // output: {a: a, b: 10, c: {d: d, e: Hello d, f: Hi \"a\", am I deep enough, or need to show \"Hello d\" with 10}}\n  print(obj);\n  // original object is not changed\n  // output: {a: a, b: 10, c: {d: d, e: Hello {c.d}, f: Hi \"{a}\", am I deep enough, or need to show \"{c.e}\" with {b}}}\n}\n```\n\n## Features and bugs\n\nPlease file feature requests and bugs at the [issue tracker][tracker].\n\n[tracker]: https://github.com/Terran-Source/dart-interpolation/issues\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fterran-source%2Fdart-interpolation","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fterran-source%2Fdart-interpolation","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fterran-source%2Fdart-interpolation/lists"}