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

# Flutter SDK

> Install and use the Tuteliq Flutter SDK

The Tuteliq Flutter SDK provides a Dart client for the Tuteliq child safety API. It supports iOS, Android, web, macOS, and Linux via Flutter 3.10+.

## Installation

Add the package to your `pubspec.yaml`:

```yaml theme={"dark"}
dependencies:
  tuteliq: ^1.0.0
```

Then run:

```bash theme={"dark"}
flutter pub get
```

## Initialize the client

```dart theme={"dark"}
import 'package:tuteliq/tuteliq.dart';

final tuteliq = Tuteliq(apiKey: 'YOUR_API_KEY');
```

<Warning>
  Never hardcode API keys in source code. Use `--dart-define`, environment variables, or a secrets manager.
</Warning>

```dart theme={"dark"}
final tuteliq = Tuteliq(
  apiKey: const String.fromEnvironment('TUTELIQ_API_KEY'),
);
```

## Detect unsafe content

Scan a single text input for harmful content across all KOSA categories.

```dart theme={"dark"}
final result = await tuteliq.detectUnsafe(
  text: "Let's meet at the park after school, don't tell your parents",
  ageGroup: AgeGroup.tenToTwelve,
);

print(result.safe);        // false
print(result.severity);    // Severity.high
print(result.categories);  // [Category.grooming, Category.secrecy]
```

## Detect grooming patterns

Analyze a conversation history for grooming indicators.

```dart theme={"dark"}
final result = await tuteliq.detectGrooming(
  messages: [
    Message(role: Role.stranger, text: 'Hey, how old are you?'),
    Message(role: Role.child, text: "I'm 11"),
    Message(role: Role.stranger, text: 'Cool. Do you have your own phone?'),
    Message(role: Role.stranger, text: "Let's talk on a different app, just us"),
  ],
  ageGroup: AgeGroup.tenToTwelve,
);

print(result.groomingDetected); // true
print(result.riskScore);        // 0.92
print(result.stage);            // GroomingStage.isolation
```

## Analyze emotions

Evaluate emotional well-being from conversation text.

```dart theme={"dark"}
final result = await tuteliq.analyzeEmotions(
  text: 'Nobody at school talks to me anymore. I just sit alone every day.',
  ageGroup: AgeGroup.thirteenToFifteen,
);

print(result.emotions);   // [Emotion(label: 'sadness', score: 0.87), ...]
print(result.distress);   // true
print(result.riskLevel);  // RiskLevel.elevated
```

## Analyze voice

Upload an audio file for transcription and safety analysis.

```dart theme={"dark"}
import 'dart:io';

final audioFile = File('recording.wav');

final result = await tuteliq.analyzeVoice(
  file: audioFile,
  ageGroup: AgeGroup.thirteenToFifteen,
);

print(result.transcript);
print(result.safe);
print(result.emotions);
```

## Flutter widget integration

<Info>
  The SDK works with any Flutter state management solution — Provider, Riverpod, Bloc, or plain `setState`.
</Info>

```dart theme={"dark"}
class SafetyCheckWidget extends StatefulWidget {
  @override
  _SafetyCheckWidgetState createState() => _SafetyCheckWidgetState();
}

class _SafetyCheckWidgetState extends State<SafetyCheckWidget> {
  final tuteliq = Tuteliq(
    apiKey: const String.fromEnvironment('TUTELIQ_API_KEY'),
  );
  bool? _isSafe;

  Future<void> _checkContent(String text) async {
    final result = await tuteliq.detectUnsafe(
      text: text,
      ageGroup: AgeGroup.thirteenToFifteen,
    );
    setState(() => _isSafe = result.safe);
  }

  @override
  Widget build(BuildContext context) {
    return Text(_isSafe == true ? 'Content is safe' : 'Checking...');
  }
}
```

## Fraud detection and safety extended

These methods cover financial exploitation, romance scams, and coercive behaviour targeting minors. Other endpoints — `detectAppFraud`, `detectMuleRecruitment`, `detectGamblingHarm`, `detectCoerciveControl`, and `detectRadicalisation` — follow the same call pattern shown here.

### Detect social engineering

Identify manipulation tactics designed to trick a child into disclosing information or taking unsafe actions.

```dart theme={"dark"}
final result = await tuteliq.detectSocialEngineering(
  text: "If you really trusted me you'd send me your home address. All my real friends do.",
  ageGroup: AgeGroup.tenToTwelve,
);

print(result.detected);    // true
print(result.tactics);     // [Tactic.trustExploitation, Tactic.peerPressure]
print(result.riskScore);   // 0.88
```

### Detect romance scam

Analyze conversation text for romantic manipulation patterns that may indicate an adult posing as a peer.

```dart theme={"dark"}
final result = await tuteliq.detectRomanceScam(
  messages: [
    Message(role: Role.stranger, text: "I've never felt this way about anyone before. You're so mature for your age."),
    Message(role: Role.child, text: "Really? That makes me really happy."),
    Message(role: Role.stranger, text: "I need you to keep us a secret. People wouldn't understand."),
  ],
  ageGroup: AgeGroup.thirteenToFifteen,
);

print(result.detected);    // true
print(result.riskScore);   // 0.91
print(result.indicators);  // [Indicator.loveBombing, Indicator.secrecyRequest, Indicator.ageFlattery]
```

### Detect vulnerability exploitation

Detect attempts to identify and target emotional or situational vulnerabilities in a child.

```dart theme={"dark"}
final result = await tuteliq.detectVulnerabilityExploitation(
  text: "I know you said your parents don't listen to you. I'm different — I actually care. You can tell me anything.",
  ageGroup: AgeGroup.thirteenToFifteen,
);

print(result.detected);         // true
print(result.riskScore);        // 0.85
print(result.vulnerabilities);  // [Vulnerability.parentalConflict, Vulnerability.emotionalNeglect]
```

### Analyse multiple texts in one request

Run any supported detection across multiple texts in a single API call to reduce round-trips.

```dart theme={"dark"}
final result = await tuteliq.analyseMulti(
  inputs: [
    AnalyseMultiInput(text: "You're so special. Nobody else understands you like I do.", ageGroup: AgeGroup.thirteenToFifteen),
    AnalyseMultiInput(text: "Can you keep a secret from your mum?", ageGroup: AgeGroup.tenToTwelve),
  ],
  detections: [Detection.socialEngineering, Detection.romanceScam, Detection.grooming],
);

print(result.results[0].detections);  // AnalyseMultiDetections(socialEngineering: ..., ...)
print(result.results[1].detections);  // AnalyseMultiDetections(grooming: ..., ...)
```

<Info>
  `analyseMulti` is billed per individual input × detection combination, not per request.
</Info>

## Error handling

The SDK throws typed exceptions that you can catch and inspect.

```dart theme={"dark"}
import 'package:tuteliq/tuteliq.dart';

try {
  final result = await tuteliq.detectUnsafe(
    text: 'some content',
    ageGroup: AgeGroup.tenToTwelve,
  );
} on TuteliqError catch (e) {
  print(e.code);    // e.g. 'AUTH_INVALID_KEY'
  print(e.message); // human-readable description
  print(e.status);  // HTTP status code
}
```

## Configuration options

```dart theme={"dark"}
final tuteliq = Tuteliq(
  apiKey: const String.fromEnvironment('TUTELIQ_API_KEY'),
  baseUrl: 'https://api.tuteliq.ai',  // default
  timeout: Duration(seconds: 30),      // request timeout
  retries: 2,                          // automatic retries on failure
);
```

## Next steps

<CardGroup cols={2}>
  <Card title="API Reference" icon="code" href="/api-reference/introduction">
    Explore the full API specification.
  </Card>

  <Card title="Kotlin SDK" icon="android" href="/sdks/kotlin">
    See the Kotlin SDK guide.
  </Card>
</CardGroup>
