When to use Natlas Flutter
Natlas Flutter brings Nigeria's sovereign large language model (LLM) directly into your Flutter applications. The package offers a unified API for text‑based chat, real‑time streaming responses, and voice‑to‑text transcription, all powered by a model that understands Hausa, Igbo, Yorùbá, and Nigerian English. In addition, Natlas Flutter ships with a collection of pre‑built widgets that render language‑specific UI components, making it easy to build culturally aware experiences without writing custom localisation logic. By handling authentication, request throttling, and response parsing internally, the SDK lets developers focus on the user experience rather than the intricacies of LLM integration.
Designed for developers who need a locally relevant conversational AI, Natlas Flutter shines in scenarios where language nuance matters. Whether you are building a customer‑support chatbot that must answer in Hausa, an educational app that teaches Igbo grammar, or a voice‑enabled assistant that understands Nigerian English slang, the SDK provides low‑latency, on‑device‑friendly endpoints that respect regional dialects. The streaming capability enables progressive UI updates, allowing chat bubbles to appear word‑by‑word, while the transcription service turns spoken input into accurate text, opening doors for hands‑free interactions in mobile and desktop environments.
From an architectural perspective, Natlas Flutter fits cleanly into any state‑management pattern common to Flutter. The core client is a lightweight, immutable service that can be injected via Provider, Riverpod, or Bloc, ensuring that UI layers remain decoupled from network concerns. Because the SDK returns Dart streams for both chat and transcription, it aligns naturally with reactive paradigms such as RxDart or the built‑in StreamBuilder widget. This makes it straightforward to compose Natlas responses with existing business logic, cache results, or trigger side‑effects like analytics events without breaking the separation of concerns.
Getting started is a matter of a single command and a few lines of code. After adding the dependency with `flutter pub add natlas_flutter`, import the package, configure your API key, and instantiate the `NatlasClient`. The client offers methods like `sendMessage`, `streamChat`, and `transcribeAudio`, each returning either a `Future` or a `Stream` that can be consumed by standard Flutter widgets. In production, be mindful of network reliability and rate limits; the SDK includes built‑in exponential back‑off and optional caching layers to mitigate spikes in traffic. Secure storage of the API key, proper permission handling for microphone access, and compliance with local data‑privacy regulations are also essential steps before releasing your app to the market.
For newcomers, a simple use case might be a multilingual FAQ bot embedded in a tourism app. By dropping the `NatlasChatWidget` into a screen and supplying the desired language code, the widget handles UI rendering, streaming responses, and voice input out of the box. More advanced developers can combine the transcription service with custom UI to build voice‑driven forms or integrate the LLM into a recommendation engine that tailors content based on user queries in any of the supported languages. The flexibility of Natlas Flutter means you can start with a ready‑made widget and gradually evolve toward a fully custom solution as your product matures.
Pros
- native support for four Nigerian languages
- ready‑made UI widgets reduce localisation effort
- streaming responses enable progressive UI updates
- voice transcription works offline on supported platforms
- lightweight client fits into any state‑management solution
Watch outs
- still early version (0.1.0) – API may change
- limited to languages currently supported by Natlas
- requires internet connection for most features
- voice transcription not available on web
Setup notes
Add the dependency with: ``` flutter pub add natlas_flutter ``` Then import the package and initialise the client with your API key: ```dart import 'package:natlas_flutter/natlas_flutter.dart'; final natlas = NatlasClient(apiKey: 'YOUR_NATLAS_API_KEY'); ``` For voice features, ensure microphone permissions are declared in AndroidManifest.xml and Info.plist.
Requires Flutter SDK >=2.19.0. Supports Android, iOS, web, and desktop (Windows, macOS, Linux). Web usage needs HTTPS and a valid CORS configuration on the Natlas endpoint. Voice transcription is unavailable on web browsers that do not expose the MediaRecorder API.
import 'package:flutter/material.dart';
import 'package:natlas_flutter/natlas_flutter.dart';
void main() => runApp(const MyApp());
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
home: const ChatScreen(),
);
}
}
class ChatScreen extends StatefulWidget {
const ChatScreen({super.key});
@override
State<ChatScreen> createState() => _ChatScreenState();
}
class _ChatScreenState extends State<ChatScreen> {
final NatlasClient _client = NatlasClient(apiKey: 'YOUR_NATLAS_API_KEY');
final TextEditingController _controller = TextEditingController();
final List<String> _messages = [];
void _send() async {
final userMsg = _controller.text;
setState(() => _messages.add('You: $userMsg'));
_controller.clear();
final response = await _client.sendMessage(userMsg, language: 'ha');
setState(() => _messages.add('Natlas: ${response.text}'));
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(title: const Text('Natlas Chat (Hausa)')),
body: Column(
children: [
Expanded(
child: ListView.builder(
itemCount: _messages.length,
itemBuilder: (_, i) => ListTile(title: Text(_messages[i])),
),
),
Padding(
padding: const EdgeInsets.all(8.0),
child: Row(
children: [
Expanded(
child: TextField(controller: _controller, decoration: const InputDecoration(hintText: 'Enter message')),
),
IconButton(icon: const Icon(Icons.send), onPressed: _send),
],
),
),
],
),
);
}
}