Skip to main content

codeskop_tracker 0.4.0 copy "codeskop_tracker: ^0.4.0" to clipboard
codeskop_tracker: ^0.4.0 copied to clipboard

Codeskop SDK Flutter plugin — captures Dart and native failures and forwards them to the Codeskop ingest backend.

codeskop_tracker (Flutter plugin) #

Thin Flutter wrapper over the native Codeskop SDK. It does not reimplement capture — it forwards the Dart API to the native AAR / XCFramework over a platform channel and wires Dart-side error hooks. See ../docs/07-integration-guide.md §7.5.

Why this isn't in the Gradle build #

Flutter plugins are built by the Flutter toolchain (flutter pub, then Flutter's own Gradle/CocoaPods integration), not by this repo's root settings.gradle.kts. That's why :tracker-flutter is excluded from the Gradle module list.

Structure #

tracker-flutter/
├── pubspec.yaml                    # plugin manifest
├── lib/codeskop_tracker.dart       # Dart API + error hooks + stack parser
├── android/                        # CodeskopTrackerPlugin.kt  -> :tracker-android
├── ios/                            # CodeskopTrackerPlugin.swift + podspec (vendors CodeskopSDK.xcframework)
├── example/                        # app exercising Dart + native capture
└── test/                           # Dart unit tests (mock MethodChannel)

Usage #

import 'package:codeskop_tracker/codeskop_tracker.dart';

void main() {
  // Guarded zone installs FlutterError.onError, PlatformDispatcher.onError and a
  // runZonedGuarded handler, so Dart failures are captured alongside native ones.
  Codeskop.runGuarded(() async {
    await Codeskop.init(apiKey: 'cs_live_pk_…', endpoint: 'https://api.codeskop.com');
    runApp(const MyApp());
  });
}

Product analytics (Growth and Scale):

MaterialApp(navigatorObservers: [CodeskopNavigatorObserver()], ...); // named routes as screens
await Codeskop.track('login_failed',
    properties: {'method': 'password', 'reason': 'invalid_password'},
    category: 'identity'); // lifecycle | navigation | interaction | identity | conversion
await Codeskop.identify('u_1042'); // on login
await Codeskop.reset();            // on logout: new anonymous id

There is no automatic tap capture: track the taps that matter with category: 'interaction'. Sessions, the anonymous id and lifecycle events ($app_opened, $session_started, …) come from the native SDK on both platforms.

Handled errors: Codeskop.recordError(e, stack). HTTP failures from a Dart client (e.g. a Dio interceptor) forward via Codeskop.captureApiError(...). Native crashes underneath Flutter are captured by the native SDK's own handlers.

Building locally #

The native SDK must be resolvable before the plugin builds:

# Android: publish the native SDK to mavenLocal (the plugin depends on
# com.codeskop.sdk:tracker-android:0.4.0).
./gradlew :tracker-core:publishToMavenLocal :tracker-android:publishToMavenLocal

# iOS: assemble the XCFramework the podspec vendors.
DEVELOPER_DIR=/Applications/Xcode.app/Contents/Developer \
  ./gradlew :tracker-core:assembleCodeskopSDKDebugXCFramework
cp -R tracker-core/build/XCFrameworks/debug/CodeskopSDK.xcframework tracker-flutter/ios/Frameworks/

# Then:
(cd tracker-flutter && flutter test)                                   # Dart unit tests
(cd tracker-flutter/example && flutter build apk --debug)              # Android
(cd tracker-flutter/example && flutter build ios --simulator --no-codesign)  # iOS (needs CocoaPods)
0
likes
150
points
480
downloads

Documentation

API reference

Publisher

unverified uploader

Weekly Downloads

Codeskop SDK Flutter plugin — captures Dart and native failures and forwards them to the Codeskop ingest backend.

Repository (GitHub)
View/report issues

License

Apache-2.0 (license)

Dependencies

flutter

More

Packages that depend on codeskop_tracker

Packages that implement codeskop_tracker