Skip to content

brainCloud helper package. brainCloud_dart_peristence provide a persistence support into the platform preferences

License

Notifications You must be signed in to change notification settings

getbraincloud/braincloud-dart-persistence

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

brainCloud Dart Persistence Helper

The brainCloud Dart Persistence Helper package provides persistence support for the brainCloud Dart SDK by integrating platform preferences using SharedPreferencesAsync or SecureDataPersistence.

Features

  • Simplifies data storage and retrieval by leveraging SharedPreferencesAsync or SecureDataPersistence.
  • Facilitates seamless integration with the brainCloud Dart SDK.

Getting started

To use this package, add it to your project dependencies:

flutter pub add braincloud_dart_peristence

Usage

Initialize the BrainCloudWrapper with the persistence helper during setup:

import 'package:braincloud/braincloud.dart';
import 'package:braincloud_dart_persistence/braincloud_dart_persistence.dart';

final bcWrapper = BrainCloudWrapper(
  wrapperName: "FlutterTest",
  persistence: DataPersistence(),
);

or using SecureDataPersistence

import 'package:braincloud/braincloud.dart';
import 'package:braincloud_dart_persistence/braincloud_dart_persistence.dart';

final bcWrapper = BrainCloudWrapper(
  wrapperName: "FlutterTest",
  persistence: SecureDataPersistence(),
);

Custom Persistence Class

If you prefer to implement your own persistence logic, you can create a class that implements the DataPersistenceBase interface and pass it to the BrainCloudWrapper during initialization.

Example:

class CustomPersistence implements DataPersistenceBase {
  @override
  Future<void> save(String key, String value) async {
    // Custom logic to save data
  }

  @override
  Future<String?> load(String key) async {
    // Custom logic to retrieve data
    return null;
  }
}

Then, use your custom preistence class:

final bcWrapper = BrainCloudWrapper(
  wrapperName: "FlutterTest",
  persistence: CustomPersistence(),
);

Additional Information

For more details on how to use brainCloud or to explore advanced features, refer to the brainCloud documentation .

About

brainCloud helper package. brainCloud_dart_peristence provide a persistence support into the platform preferences

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages