Skip to main content

Initialization

To start using the Altibbi Flutter SDK, you must initialize the AltibbiService once at the beginning of your application (usually in the main() function or your app's entry state).

Initializing AltibbiService

The init method allows you to set the user token, partner base URL, language, and the optional Sina AI endpoint.

import 'package:altibbi/altibbi_service.dart';

void main() {
AltibbiService.init(
token: 'YOUR_AUTH_TOKEN', // Required: User/Partner token
baseUrl: 'https://api.altibbi.com', // Required: Partner environment URL
language: 'ar', // Optional: 'ar' or 'en' (default)
sinaModelEndPoint: 'SINA_URL' // Optional: For Sina AI integration
);

// Optionally enable logging for debugging
AltibbiService.enableLogging = true;

runApp(const MyApp());
}

Accessing the API Service

Once initialized, you can instantiate the ApiService anywhere in your app to make requests.

import 'package:altibbi/service/api_service.dart';

ApiService apiService = ApiService();