abto 0.0.1 copy "abto: ^0.0.1" to clipboard
abto: ^0.0.1 copied to clipboard

ABTO analytics SDK for Flutter/Dart — user behavior x LLM cost/latency/quality attribution. Follows the same event contract as the browser SDK (packages/sdk).

abto (Flutter/Dart) #

ABTO Browser SDK(packages/sdk)와 동일한 이벤트 계약을 따르는 Dart SDK. 코어는 순수 Dart(dart:io)라 Flutter 의존이 없다 — Flutter 앱에서 그대로 import 해서 쓰고, 검증은 dart test 로 어디서든 돈다 (ABTO-172 "flutter 지원 고려"의 답: 플랫폼 채널 없이 Dart 패키지 하나로 iOS/Android/웹 밖 Flutter 전 타깃 커버).

envelope(event_id·timestamp·source: "flutter"·schema_version·식별자)를 붙여 POST {endpoint} {"batch": […]} + Authorization: Bearer <projectKey> 로 배치 전송한다.

사용 #

import 'package:abto/abto.dart';

final abto = AbtoClient(
  AbtoConfig(
    projectKey: 'pk_live_…',
    endpoint: 'https://api.abto.ai/v1/events', // 생략 시 기본값
    environment: AbtoEnvironment.production,
  ),
  store: SharedPreferencesStore(prefs), // Flutter 에선 어댑터 권장, 생략 시 인메모리
);

abto.identify('u_123', 't_1');

// LLM call 이전 biz event — 수동 capture
abto.capture('checkout_started', properties: {'cart_size': 3});

// LLM 호출 생애주기 — request_id 로 게이트웨이 비용/latency 와 조인
final trace = abto.startLlmTrace(nodeId: 'resume.make', taskType: 'draft_generation');
trace.submitPrompt(prompt: '이력서 초안 작성해줘', language: 'ko');
trace.attachRequestIdFromHeaders(response.headers); // x-request-id
trace.markResponseVisible(responseId: 'resp_1', timeToVisibleMs: 1200);
trace.captureOutcome('accepted', responseId: 'resp_1');

await abto.flush();

Flutter 영속화 어댑터 예 (shared_preferences):

class SharedPreferencesStore implements AbtoKeyValueStore {
  SharedPreferencesStore(this._prefs);
  final SharedPreferences _prefs;

  @override
  String? get(String key) => _prefs.getString(key);

  @override
  void set(String key, String value) => _prefs.setString(key, value);
}
  • anonymous_id는 store 에 영속, session_id는 클라이언트 생성마다 갱신.
  • 캡처는 기본 full — 브라우저 SDK 와 동일한 2026-07-02 정책.
  • 전송 실패는 앱으로 throw 되지 않고 내부 버퍼(최대 1000건)로 재적재된다.

검증 #

dart pub get
dart test                    # 단위 검증
ABTO_E2E=1 dart test         # + dev collector(:4870) 실전송 E2E
0
likes
140
points
100
downloads

Documentation

API reference

Publisher

verified publisherabto.app

Weekly Downloads

ABTO analytics SDK for Flutter/Dart — user behavior x LLM cost/latency/quality attribution. Follows the same event contract as the browser SDK (packages/sdk).

Repository (GitHub)

License

MIT (license)

More

Packages that depend on abto