xrpc 1.0.3
xrpc: ^1.0.3 copied to clipboard
Core library for XRPC communication. This is a wrapped HTTP client for AT Protocol.
Core library for XRPC communication π¦
1. Guide π #
This library provides the easiest way to use XRPC communication supported by AT Protocol in Dart and Flutter apps.
1.1. Getting Started β‘ #
1.1.1. Install Library #
With Dart:
dart pub add xrpc
Or With Flutter:
flutter pub add xrpc
1.1.2. Import #
import 'package:xrpc/xrpc.dart';
1.1.3. Implementation #
import 'package:atproto/atproto.dart' as atproto;
import 'package:xrpc/xrpc.dart' as xrpc;
Future<void> main() async {
final response = await xrpc.procedure(
xrpc.NSID.create(
'session.atproto.com',
'create',
),
body: {
'handle': 'HANDLE',
'password': 'PASSWORD',
},
to: atproto.Session.fromJson,
);
final session = await xrpc.query(
xrpc.NSID.create(
'session.atproto.com',
'get',
),
headers: {'Authorization': 'Bearer ${response.data.accessJwt}'},
to: atproto.CurrentSession.fromJson,
);
print(session);
}