at_client 3.4.2 copy "at_client: ^3.4.2" to clipboard
at_client: ^3.4.2 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;
copied to clipboard
  • These preferences are used for your application.
AtClientManager atClientManagerInstance = await AtClientManager.getInstance().setCurrentAtSign(atSign, AtEnv.appNamespace, preferences);
copied to clipboard
  • Update the user data using the put() method.
AtKey atKey = AtKey()
        ..key = 'phone'
        ..namespace = '.myApp';
await atClientInstance.put(atKey, '+00 123-456-7890');
copied to clipboard
  • 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
copied to clipboard
  • Delete the data using the delete() method.
bool isDeleted = await atClientInstance.delete(atKey);
print(isDeleted); // true if deleted
copied to clipboard
  • Sync the data to the server using the sync() method if needed.
late SyncService _syncService;
_syncService = atClientManagerInstance.syncService;
_syncService.sync();
copied to clipboard
  • 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
copied to clipboard
  • 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));
copied to clipboard
  • 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');
  }
});
copied to clipboard

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
150
points
6.23k
downloads

Publisher

verified publisheratsign.org

Weekly Downloads

2024.09.08 - 2025.03.23

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)
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