{"id":16401748,"url":"https://github.com/xaldarof/jt-preferences","last_synced_at":"2026-01-11T04:46:45.608Z","repository":{"id":95185861,"uuid":"607509355","full_name":"xaldarof/jt-preferences","owner":"xaldarof","description":"Preferences integrates seamlessly into your projects, enhancing user experience and app functionality. Simplify preference management and optimize your app with JT Preferences.","archived":false,"fork":false,"pushed_at":"2025-02-21T08:55:46.000Z","size":7045,"stargazers_count":5,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-05-29T09:14:06.310Z","etag":null,"topics":["dart","encryption","flutter","json","key-value","preferences"],"latest_commit_sha":null,"homepage":"","language":"Dart","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/xaldarof.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,"zenodo":null}},"created_at":"2023-02-28T05:28:29.000Z","updated_at":"2025-02-21T08:55:51.000Z","dependencies_parsed_at":"2024-11-09T17:35:46.999Z","dependency_job_id":"ea886dc7-361c-4c1e-8594-149e4ada7c4a","html_url":"https://github.com/xaldarof/jt-preferences","commit_stats":{"total_commits":54,"total_committers":3,"mean_commits":18.0,"dds":"0.40740740740740744","last_synced_commit":"843e5f60b4d5cd926de495bbd49c05dbd38317fc"},"previous_names":["xaldarof/jt-preferences","xaldarof/jt_preferences"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/xaldarof/jt-preferences","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xaldarof%2Fjt-preferences","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xaldarof%2Fjt-preferences/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xaldarof%2Fjt-preferences/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xaldarof%2Fjt-preferences/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/xaldarof","download_url":"https://codeload.github.com/xaldarof/jt-preferences/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xaldarof%2Fjt-preferences/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":268199634,"owners_count":24211823,"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-08-01T02:00:08.611Z","response_time":67,"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","encryption","flutter","json","key-value","preferences"],"created_at":"2024-10-11T05:44:03.707Z","updated_at":"2026-01-11T04:46:45.572Z","avatar_url":"https://github.com/xaldarof.png","language":"Dart","funding_links":[],"categories":[],"sub_categories":[],"readme":"# JtPreferences\n\n[![pub package](https://img.shields.io/pub/v/shared_preferences.svg)](https://pub.dev/packages/jt_preferences)\n\nSupported data types are `int`, `double`, `bool`, `String` and `Writable object`.\n\n## Usage\n\nTo use this plugin, add `jt_preferences` as\na [dependency in your pubspec.yaml file](https://flutter.dev/docs/development/platform-integration/platform-channels)\n.\n\n### Examples\n\nHere are small examples that show you how to use the package.\n\n### Initialize\n\n```dart\nvoid main(List\u003cString\u003e args) async {\n  //for example (data/data/com.example.application/) without absolute path\n  await JtPreferences.initialize(\"path/path\", encryptionKey: '16 length encryption key');\n  //Data will be encrypted if encryptionKey is not null\n}\n```\n\n\n#### Write data\n```dart\n// Obtain shared preferences.\nfinal preferences = await JtPreferences.getInstance();\n\n// Save an integer value to 'counter' key.\nawait preferences.setInt('counter', 10);\n// Save an boolean value to 'repeat' key.\nawait preferences.setBool('repeat', true);\n// Save an double value to 'decimal' key.\nawait preferences.setDouble('decimal', 1.5);\n// Save an String value to 'action' key.\nawait preferences.setString('action', 'Start');\n\n//Save writable object\nawait preferences.saveObject(User(name: 'user', age: 12));\n\n```\n### Example User Writable object\n```dart\nclass User extends Writable {\n  final String name;\n  final int age;\n\n  @override\n  factory User.fromJson(Map\u003cString, dynamic\u003e map) {\n    return User(name: map['name'], age: map['age']);\n  }\n\n  @override\n  OnConflictStrategy? get onConflictStrategy =\u003e OnConflictStrategy.update;\n\n  @override\n  Map\u003cString, dynamic\u003e toJson() {\n    return {\n      \"name\": name,\n      \"age\": age,\n    };\n  }\n\n  User({\n    required this.name,\n    required this.age,\n  });\n\n  @override\n  String key =\u003e name;\n}\n\n```\n\n\n\n#### Read data\n```dart\n// Try reading data from the 'counter' key. If it doesn't exist, returns null.\nfinal int? counter = preferences.getInt('counter');\n// Try reading data from the 'repeat' key. If it doesn't exist, returns null.\nfinal bool? repeat = preferences.getBool('repeat');\n// Try reading data from the 'decimal' key. If it doesn't exist, returns null.\nfinal double? decimal = preferences.getDouble('decimal');\n// Try reading data from the 'action' key. If it doesn't exist, returns null.\nfinal String? action = preferences.getString('action');\n\nfinal List\u003cString\u003e? keys = preferences.getKeys();\n\nfinal object = preferences.getObject('user', (map) =\u003e User.fromJson(map));\nprint(object?.name);\nprint(object?.age);\n\n//Reload data from storage\n_preferences.reload();\n\n```\n\n### Listen changes\n```dart\n//listen all changes\npreferences.listen().listen((event) {\n  print(\"key $event updated\");\n});\n\n//listen only specific key\npreferences.stream(key: 'counter').listen((event) {\n   print(\"key $event updated\");\n});\n\n```\n\n\n#### Remove an entry\n```dart\n// Remove data for the 'counter' key.\nfinal success = await preferences.remove('counter');\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxaldarof%2Fjt-preferences","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fxaldarof%2Fjt-preferences","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxaldarof%2Fjt-preferences/lists"}