Zeba Academy Secure Storage ๐Ÿ”

A simple, secure, and developer-friendly Flutter package for encrypted storage, token management, and secure data handling.

pub package License: GPL Flutter


โœจ Features

โœ… Secure encrypted storage โœ… Authentication token management โœ… Refresh token support โœ… JSON data storage โœ… Simple read/write/delete APIs โœ… Clear all stored data โœ… Error handling with custom exceptions โœ… Null-safe and production-ready โœ… Easy Flutter integration


๐Ÿ“ฆ Installation

Add this package to your pubspec.yaml:

dependencies:
  zeba_academy_secure_storage: ^1.0.0

Run:

flutter pub get

๐Ÿš€ Usage

Import the package:

import 'package:zeba_academy_secure_storage/zeba_academy_secure_storage.dart';

Create storage instance:

final storage = ZebaSecureStorage();

๐Ÿ”‘ Token Storage

Save Token

await storage.saveToken(
  "your_access_token",
);

Get Token

final token =
    await storage.getToken();

print(token);

Delete Token

await storage.deleteToken();

๐Ÿ”„ Refresh Token

Save refresh token:

await storage.saveRefreshToken(
  "refresh_token_value",
);

Get refresh token:

final refreshToken =
    await storage.getRefreshToken();

๐Ÿ’พ Custom Secure Data

Store Data

await storage.write(
  "username",
  "Sufyan",
);

Read Data

final username =
    await storage.read(
      "username",
    );

Delete Data

await storage.delete(
  "username",
);

๐Ÿ“‹ JSON Storage

Save JSON:

await storage.saveJson(
  "profile",
  {
    "name": "Sufyan",
    "role": "developer",
  },
);

Read JSON:

final profile =
    await storage.getJson(
      "profile",
    );

print(profile);

๐Ÿงน Clear Storage

Remove all stored values:

await storage.clear();

๐Ÿ›  API Reference

Method Description
write() Store secure string data
read() Read secure data
delete() Remove specific key
clear() Remove all data
saveToken() Store authentication token
getToken() Retrieve authentication token
deleteToken() Delete token
saveRefreshToken() Store refresh token
getRefreshToken() Retrieve refresh token
saveJson() Store JSON object
getJson() Read JSON object

๐Ÿ“ฑ Example

class AuthService {

final storage = ZebaSecureStorage();


Future<void> login() async {

  await storage.saveToken(
    "abc123",
  );

}


Future<String?> token() {

 return storage.getToken();

}

}

โš™๏ธ Platform Support

Platform Supported
Android โœ…
iOS โœ…
Web โš ๏ธ
Windows โœ…
macOS โœ…
Linux โœ…

๐Ÿค Contributing

Contributions are welcome!

Steps:

  1. Fork this repository
  2. Create a feature branch
git checkout -b feature/new-feature
  1. Commit changes
git commit -m "Add new feature"
  1. Push changes
git push origin feature/new-feature
  1. Open a Pull Request

๐Ÿ“„ License

This project is licensed under the GNU General Public License v3.0 (GPL-3.0).

You are free to use, modify, and distribute this software under the GPL terms.

See the full license:

LICENSE

๐Ÿ‘จโ€๐Ÿ’ป About Me

โœจ Iโ€™m Sufyan bin Uzayr, an open-source developer passionate about building and sharing meaningful projects.

Learn more about my work:

๐ŸŒ sufyanism.com ๐Ÿ’ผ LinkedIn


๐Ÿš€ Your all-in-one learning hub!

Explore courses and resources in coding, technology, and development.

Zeba Academy helps developers build practical skills through tutorials, projects, and hands-on learning.

๐ŸŒ Website: https://zeba.academy

๐Ÿ’ป Courses & resources: https://code.zeba.academy

โ–ถ YouTube: https://www.youtube.com/@zeba.academy

๐Ÿ“ธ Instagram: https://www.instagram.com/zeba.academy/


Thank you for using Zeba Academy Secure Storage! โค๏ธ