xrpc

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 poptart_xrpc

Or With Flutter:

 flutter pub add poptart_xrpc

1.1.2. Import

import 'package:poptart_xrpc/poptart_xrpc.dart';

1.1.3. Implementation

import 'package:poptart_lex/com/atproto/server/create_session.dart'
    as create_session;
import 'package:poptart_xrpc/poptart_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: create_session.ServerCreateSessionOutput.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);
}

Libraries

http
poptart_xrpc