{"id":20268786,"url":"https://github.com/dammak/jsonplaceholder_offline","last_synced_at":"2026-05-09T09:02:46.079Z","repository":{"id":56833439,"uuid":"235815593","full_name":"DAMMAK/jsonplaceholder_offline","owner":"DAMMAK","description":"A simple jsonplaceholder package that allow you to get a random data for your flutter project without relying on the internet","archived":false,"fork":false,"pushed_at":"2020-05-20T19:39:35.000Z","size":415,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-23T01:36:24.037Z","etag":null,"topics":["dart","dart-package","flutter","flutter-package"],"latest_commit_sha":null,"homepage":"","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/DAMMAK.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":"2020-01-23T14:47:31.000Z","updated_at":"2021-08-06T15:53:18.000Z","dependencies_parsed_at":"2022-09-10T04:17:02.554Z","dependency_job_id":null,"html_url":"https://github.com/DAMMAK/jsonplaceholder_offline","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/DAMMAK/jsonplaceholder_offline","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DAMMAK%2Fjsonplaceholder_offline","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DAMMAK%2Fjsonplaceholder_offline/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DAMMAK%2Fjsonplaceholder_offline/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DAMMAK%2Fjsonplaceholder_offline/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/DAMMAK","download_url":"https://codeload.github.com/DAMMAK/jsonplaceholder_offline/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DAMMAK%2Fjsonplaceholder_offline/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":260896013,"owners_count":23078928,"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","dart-package","flutter","flutter-package"],"created_at":"2024-11-14T12:20:06.015Z","updated_at":"2026-05-09T09:02:41.041Z","avatar_url":"https://github.com/DAMMAK.png","language":"Dart","funding_links":[],"categories":[],"sub_categories":[],"readme":"# jsonplaceholder_offline\n\nA simple package that allows you to get data for your project on the go without relying on the network\n\n## Installation\n\nAdd this to your package's pubspec.yaml file\n\n```dart\ndependencies:\n    jsonplaceholder_offline: 1.0.3\n```\n\nand run\n\n```dart\nflutter packages get\n```\n\n## How it work\n\nThe package is offline version of[JsonPlaceholder](https://jsonplaceholder.typicode.com)\nJsonplaceholder has 6 different data categories:\n\n- User\n- Post\n- Comment\n- Album\n- Photo\n- Todo\n\nyou can get data in two format either object or json.\n\n- to get object data you will need to call `getData\u003cT\u003e(length:1)` method with length as a parameter\n- to get json data you will need to call `getJsonData\u003cT\u003e(length:1)` method with length as a parameter\n\n**_NB:_**\n\n- _length is number of data you wish to return. from (min 1 - max 100)_\n- _T is the generic reference of your category._\n\n  # Usage\n\n  ## Getting Object data\n\n### list of Users\n\n```dart\nJsonPlaceholder jsonPlaceholder = JsonPlaceholder();\nList\u003cUser\u003e users = jsonPlaceholder.getData\u003cUser\u003e(length: 20);\n```\n\n### a single User object\n\n```dart\nJsonPlaceholder jsonPlaceholder = JsonPlaceholder();\nUser user = jsonPlaceholder.getData\u003cUser\u003e(length:1);\n```\n\n## Getting Json data\n\n### list of users data\n\n```dart\nJsonPlaceholder jsonPlaceholder = JsonPlaceholder();\nList\u003cMap\u003cString, dynamic\u003e\u003e users = jsonPlaceholder.getJsonData\u003cUser\u003e(length: 20);\n```\n\n### a single User json\n\n```dart\nJsonPlaceholder jsonPlaceholder = JsonPlaceholder();\nMap\u003cString, dynamic\u003e user = jsonPlaceholder.getJsonData\u003cUser\u003e(length:1);\n```\n\n### Get UserPost by userId\n\n```dart\n JsonPlaceholder jsonPlaceholder = JsonPlaceholder();\n List\u003cdynamic\u003e comments = jsonPlaceholder.getUserPosts(userId: 1, toJson: false);\n```\n\n**\\*NB:** `toJson` property can be set to true if you want the return data to be in JSON format\\*\n\n### Get PostComment by postId\n\n```dart\nJsonPlaceholder jsonPlaceholder = JsonPlaceholder();\nList\u003cdynamic\u003e comments = jsonPlaceholder.getUserPosts(postId: 1, toJson: false);\n```\n\n**\\*NB:** `toJson` property can be set to true if you want the return data to be in JSON format\\*\n\n## Mocking HTTP Request\nif you want to get your data in HTTP Request behaviour, you can mock the behaviour using `mockHttp\u003cT\u003e({RESTMETHOD httpMethod, int delay, int length})`\n\n```dart\nJsonPlaceholder jsonPlaceholder = JsonPlaceholder();\nMap\u003cString, dynamic\u003e data = await jsonPlaceholder.mockHttp\u003cUser\u003e(httpMethod: RESTMETHOD.GET, length: 10, delay: 20);\n\n```\nNB:\n- httpMethod: {GET,POST,PUT,DELETE}\n- delay: This is the number of seconds you want your request to take before it return data.\n- length: This is the number of data you want to return\n\n**Data credit:** https://jsonplaceholder.typicode.com/\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdammak%2Fjsonplaceholder_offline","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdammak%2Fjsonplaceholder_offline","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdammak%2Fjsonplaceholder_offline/lists"}