at_client 3.0.76 copy "at_client: ^3.0.76" to clipboard
at_client: ^3.0.76 copied to clipboard

The at_client library is the non-platform specific Client SDK which provides the essential methods for building an app using the atProtocol.

The Atsign FoundationThe Atsign Foundation

Now for some internet optimism. #

pub package pub points build status gitHub license

at_client #

Introduction #

The at_client library is the non-platform specific Client SDK which provides the essential methods for building an app using the atProtocol.

SDK that provides the essential methods for building an app using The atProtocol. You may also want to look at at_client_mobile.

at_client package is written in Dart, supports Flutter and follows the atPlatform's decentralized, edge computing model with the following features:

  • Cryptographic control of data access through personal data stores
  • No application backend needed
  • End-to-end encryption where only the data owner has the keys
  • Private and surveillance free connectivity

We call giving people control of access to their data "flipping the internet".

Get Started #

Before using this package for the first time, you should follow the getting started guide

You may find it useful to read the atPlatform overview.

This package is available on pub.dev at https://pub.dev/packages/at_client

Usage #

  • Set AtClientPreferences to your preferred settings.
Directory appSupportDir = await getApplicationSupportDirectory();
AtClientPreference preferences = AtClientPreference()
        ..rootDomain = 'root.atsign.org'
        ..namespace = '.my_namespace'
        ..hiveStoragePath = appSupportDir.path
        ..commitLogPath = appSupportDirdir.path
        ..isLocalStoreRequired = true;
  • These preferences are used for your application.
AtClientManager atClientManagerInstance = await AtClientManager.getInstance().setCurrentAtSign(atSign, AtEnv.appNamespace, preferences);
  • Update the user data using the put() method.
AtKey atKey = AtKey()
        ..key = 'phone'
        ..namespace = '.myApp';
await atClientInstance.put(atKey, '+00 123-456-7890');
  • Get the data using the get() method.
AtKey atKey = AtKey()
        ..key='phone'
        ..namespace = '.myApp';
AtValue value = await atClientInstance.get(atKey);
print(value.value); // +00 123-456-7890
  • Delete the data using the delete() method.
bool isDeleted = await atClientInstance.delete(atKey);
print(isDeleted); // true if deleted
  • Sync the data to the server using the sync() method if needed.
late SyncService _syncService;
_syncService = atClientManagerInstance.syncService;
_syncService.sync();
  • Notify the server that the data has changed using the notify() method.
AtClientManager atClientManagerInstance = AtClientManager.getInstance();
MetaData metaData = Metadata()..ttl='60000'
               ..ttb='30000'
AtKey key = AtKey()..key='phone'
          ..sharedWith='@bob'
          ..metadata=metaData
        ..namespace = '.myApp';
String value = (await atClientInstance.get(atKey)).value;
OperationEnum operation = OperationEnum.update;
bool isNotified = await atClientManagerInstance.notify(atKey, value, operation);
print(isNotified); // true if notified
  • Notify an update operation to an atsign.
String toAtsign = '@bob';
var key = AtKey()
        ..key = 'phone'
        ..sharedWith = toAtSign;
var notification = NotificationServiceImpl(atClient!);
await notification.notify(NotificationParams.forUpdate(key));
  • Want to check connection status? Why another package in you app? Use ConnectivityListener.
ConnectivityListener().subscribe().listen((isConnected) {
  if (isConnected) {
    print('connection available');
   } else {
    print('connection lost');
  }
});

AtClient has many more methods that are exposed. Please refer to the atsign docs for more details.

Example #

We have a good example with explanation in the at_client_mobile package.

13
likes
140
pub points
72%
popularity

Publisher

verified publisheratsign.org

The at_client library is the non-platform specific Client SDK which provides the essential methods for building an app using the atProtocol.

Homepage
Repository (GitHub)
View/report issues
Contributing

Documentation

API reference

License

BSD-3-Clause (LICENSE)

Dependencies

archive, asn1lib, async, at_auth, at_base2e15, at_chops, at_commons, at_lookup, at_persistence_secondary_server, at_persistence_spec, at_utf7, at_utils, collection, convert, cron, crypto, crypton, encrypt, hive, http, internet_connection_checker, meta, path, uuid, version

More

Packages that depend on at_client