> For the complete documentation index, see [llms.txt](https://docs.allstak.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.allstak.io/flutter-sdk.md).

# 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:

```yaml
dependencies:
  allstak: latest_version
```

Then, run:

```sh
flutter pub get
```

***

### 🛠 Usage

#### **1️⃣ Initialize AllStak in `main.dart`**

```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:

```dart
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:

```dart
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"),
        ),
      ),
    );
  }
}
```

***

### 🔗 Links & Resources

* **📖 API Documentation:** [docs.allstak.io](https://docs.allstak.io)
* **🚀 Website:** [allstak.io](https://allstak.io)

***

### 🎯 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**! 🎉
