> ## Documentation Index
> Fetch the complete documentation index at: https://docs.law4devs.eu/llms.txt
> Use this file to discover all available pages before exploring further.

# Installation

> Install the Law4Devs Flutter/Dart SDK and make your first API call.

## Requirements

* Dart SDK >=3.0.0
* Works on Flutter (mobile, web, desktop) and Dart CLI

## Install

Add to your `pubspec.yaml`:

```yaml theme={null}
dependencies:
  law4devs: ^1.0.0
```

Then run:

```bash theme={null}
dart pub get
```

Or for Flutter projects:

```bash theme={null}
flutter pub get
```

## First Call

```dart theme={null}
import 'package:law4devs/law4devs.dart';

final client = Law4DevsClient(
  apiKey: Platform.environment['LAW4DEVS_API_KEY'],
);

final page = await client.frameworks.list();
print(page.data.first.name); // e.g. "Cyber Resilience Act"
```

## Configuration

```dart theme={null}
final client = Law4DevsClient(
  apiKey: Platform.environment['LAW4DEVS_API_KEY'],
  baseUrl: 'https://api.law4devs.eu/v1', // default
  timeout: const Duration(seconds: 30),       // default
  maxRetries: 3,                              // retries on 429/5xx
);
```

| Option       | Type       | Default                 | Description                                         |
| ------------ | ---------- | ----------------------- | --------------------------------------------------- |
| `apiKey`     | `String?`  | `null`                  | Your API key (required for authenticated endpoints) |
| `baseUrl`    | `String`   | Production URL          | Override for dev/staging environment                |
| `timeout`    | `Duration` | `Duration(seconds: 30)` | Per-request HTTP timeout                            |
| `maxRetries` | `int`      | `3`                     | Retries on 429/5xx responses                        |

## Environment Variable

```bash theme={null}
export LAW4DEVS_API_KEY="your-key"
```

```dart theme={null}
final client = Law4DevsClient(
  apiKey: Platform.environment['LAW4DEVS_API_KEY'],
);
```

<Warning>
  Never hardcode your API key in source code or commit it to version control.
</Warning>

## Verify the Install

```dart theme={null}
// verify_install.dart
import 'package:law4devs/law4devs.dart';
import 'dart:io';

void main() async {
  final client = Law4DevsClient(
    apiKey: Platform.environment['LAW4DEVS_API_KEY'],
  );
  final page = await client.frameworks.list();
  print('${page.meta.total} frameworks');
}
```

```bash theme={null}
LAW4DEVS_API_KEY=your-key dart run verify_install.dart
# → 19 frameworks
```
