Flutter SDK

AllStak Flutter SDK Documentation

We’re excited to introduce the AllStak Flutter SDK, a developer-friendly solution for error tracking and monitoring in Flutter applications.


πŸš€ Key Features

βœ… Exception Tracking

  • Automatically captures and reports runtime exceptions.

  • Provides detailed error context, including stack traces, device details, and OS information.

βœ… Device and App Context

  • Collects device-specific data such as platform, OS version, and screen size.

  • Logs application-specific details like app version, build number, and package name.

βœ… Network Request Monitoring

  • Seamlessly integrates with HTTP libraries like http and dio.

  • Tracks API requests and logs failed responses.

βœ… Flutter Integration

  • Simple setup tailored for Flutter applications.

  • Supports Android, iOS, Web, and Desktop platforms.


πŸ“¦ Installation

Add AllStak Flutter SDK to your project by updating your pubspec.yaml file:

dependencies:
  allstak: latest_version

Then, run:

flutter pub get

πŸ›  Usage

1️⃣ Initialize AllStak in main.dart

import 'package:flutter/material.dart';
import 'package:allstak/allstak.dart';

Future<void> main() async {
  WidgetsFlutterBinding.ensureInitialized();
  print('Initializing AllStak SDK...');

  await Allstak.init(
    AllstakOptions(
      apiKey: 'your-api-key-here',
      environment: 'production',
    ),
    appRunner: () => runApp(const MyApp()),
  );
}

2️⃣ Capture Exceptions

Manually catch and log exceptions:

try {
  throw Exception("Test exception for AllStak");
} catch (e, stackTrace) {
  Allstak.captureException(e, stackTrace);
}

🎨 Example App

Here’s a simple Flutter app that integrates AllStak:

import 'package:flutter/material.dart';
import 'package:allstak/allstak.dart';

void main() async {
  WidgetsFlutterBinding.ensureInitialized();

  await Allstak.init(
    AllstakOptions(
      apiKey: 'your-api-key',
      environment: 'production',
    ),
    appRunner: () => runApp(const MyApp()),
  );
}

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'AllStak Demo',
      theme: ThemeData(
        colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
        useMaterial3: true,
      ),
      home: const MyHomePage(title: 'AllStak Error Tracking Demo'),
    );
  }
}

class MyHomePage extends StatefulWidget {
  const MyHomePage({super.key, required this.title});
  final String title;

  @override
  State<MyHomePage> createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  Future<void> _triggerError() async {
    try {
      throw Exception("Simulated error for AllStak");
    } catch (e, stackTrace) {
      Allstak.captureException(e, stackTrace);
    }
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(title: Text(widget.title)),
      body: Center(
        child: ElevatedButton(
          onPressed: _triggerError,
          child: const Text("Trigger Error"),
        ),
      ),
    );
  }
}


🎯 What's Next?

We're continuously improving AllStak! Stay tuned for:

  • πŸ“Š Performance Monitoring

  • πŸ“‘ Live Issue Tracking Dashboard

Feel free to contribute and star ⭐ the repository on GitHub!


πŸš€ Start Tracking Errors Like a Pro with AllStak Flutter SDK! πŸŽ‰

Last updated