Applite Dart SDK

A comprehensive Dart/Flutter SDK for the Applite API built on top of dio. Includes API clients, type definitions, and UI components.

Full Documentation: For detailed API references and guides, visit docs.appliteui.com.

Installation

Add the package to your pubspec.yaml:

dependencies:
  applite_sdk:
    git:
      url: https://github.com/applite/applite-admin.git
      path: packages/dart_sdk

Quick Start

import 'package:dart_sdk/applite_ui.dart';

Future<void> main() async {
  final applite = AppliteUI(
    config: const AppliteUIConfig(
      baseUrl: 'https://api.applite.ai',
      headers: {'x-environment': 'staging'},
    ),
  );

  try {
    final response = await applite.app.customer.auth(
      CustomerAuthParams(
        appId: 'your-app-id',
        apiKey: 'your-api-key',
        fullname: 'Jane Doe',
        telephone: '+123456789',
      ),
    );

    print('Authenticated as: ${response.data.fullname}');
  } on ApiException catch (error) {
    print('Auth failed: ${error.message}');
  }
}

API Reference

Common Module (applite.app)

Customer API (applite.app.customer)

Method Description
auth(params) Authenticate or register a customer
check(params) Check if a customer exists by phone
list(params) List customers with optional filtering
listFew(params) List customers with minimal data
get(params) Get customer details by ID
update(params) Update customer profile
block(params) Block or unblock a customer
delete(params) Delete a customer
selfDelete(params) Customer self-deletion
// List customers
final customers = await applite.app.customer.list(
  CustomerListParams(
    appId: 'your-app-id',
    apiKey: 'your-api-key',
    plateformType: [PlateformType.STORE],
  ),
);

// Get customer details
final detail = await applite.app.customer.get(
  CustomerGetParams(
    appId: 'your-app-id',
    apiKey: 'your-api-key',
    id: 'customer-id',
  ),
);

Info API (applite.app.info)

Method Description
list(params) List all apps
getBySlug(params) Get app by slug
final apps = await applite.app.info.list(
  ListAppsParams(apiKey: 'your-api-key'),
);

final app = await applite.app.info.getBySlug(
  GetAppBySlugParams(
    apiKey: 'your-api-key',
    slug: 'my-app',
  ),
);

Address API (applite.app.address)

Method Description
list(params) List addresses
create(params) Create an address
update(params) Update an address
delete(params) Delete an address
getById(params) Get address by ID

Stats API (applite.app.stats)

Method Description
create(params) Create a statistic entry
get(params) Get statistic value
await applite.app.stats.create(
  CreateStatisticParams(
    apiKey: 'your-api-key',
    appId: 'your-app-id',
    key: 'page_views',
    value: 1,
  ),
);

Finance API (applite.app.finance)

Method Description
balance(params) Get account balance
listTransactions(params) List transactions
final balance = await applite.app.finance.balance(
  BalanceParams(
    apiKey: 'your-api-key',
    appId: 'your-app-id',
  ),
);

Welcome Item API (applite.app.welcomeItem)

Method Description
list(params) List welcome items
create(params) Create a welcome item
update(params) Update a welcome item
delete(params) Delete a welcome item

User API (applite.user)

Method Description
signup(params) Register a new user
signin(params) Sign in a user
get(params) Get user by ID
update(params) Update user profile
delete(params) Delete a user

Notification Token API (applite.app.notificationToken)

Method Description
register(params) Register a push token
unregister(params) Unregister a push token

Notification API (applite.notification)

Method Description
getFirebaseConfig(params) Get Firebase config
setFirebaseConfig(params) Set Firebase config

Webhook API (applite.webhook)

Method Description
list(params) List webhooks
set(params) Create or update a webhook
delete(params) Delete a webhook

Store Module (applite.app.store)

Full-featured e-commerce management.

Product API (applite.app.store.product)

Method Description
list(params) List products
create(params) Create a product
get(params) Get product by ID
update(params) Update a product
delete(params) Delete a product
final products = await applite.app.store.product.list(
  ListProductsParams(
    apiKey: 'your-api-key',
    appId: 'your-app-id',
  ),
);

Order API (applite.app.store.order)

Method Description
list(params) List orders
create(params) Create an order
get(params) Get order by ID
update(params) Update an order

Category API (applite.app.store.category)

Method Description
list(params) List categories
create(params) Create a category
get(params) Get category by ID
update(params) Update a category
delete(params) Delete a category
final category = await applite.app.store.category.create(
  CreateCategoryParams(
    apiKey: 'your-api-key',
    appId: 'your-app-id',
    name: 'Electronics',
    sellerId: 'seller-id',
  ),
);

Other Store APIs

API Methods
store.badge list, create, update, delete
store.collection list, create, get, update, delete
store.discount list, create, get, update, delete, check
store.option list, create, update, delete
store.seller list, create, get, update, delete
store.shipping list, create, update, delete
store.tag list, create, update, delete
store.tax list, create, update, delete

Multi-Service Module (applite.app.multiService)

Appointment-based service management.

Company API (applite.app.multiService.company)

Method Description
list(params) List companies
create(params) Create a company
get(params) Get company by ID
update(params) Update a company
delete(params) Delete a company
final companies = await applite.app.multiService.company.list(
  ListCompaniesParams(
    apiKey: 'your-api-key',
    appId: 'your-app-id',
  ),
);

Service API (applite.app.multiService.service)

Method Description
list(params) List services
create(params) Create a service
get(params) Get service by ID
update(params) Update a service
delete(params) Delete a service
final service = await applite.app.multiService.service.create(
  CreateServiceParams(
    apiKey: 'your-api-key',
    appId: 'your-app-id',
    companyId: 'company-id',
    name: 'Haircut',
    basePrice: 25.00,
  ),
);

Agent API (applite.app.multiService.agent)

Method Description
list(params) List agents
create(params) Create an agent
get(params) Get agent by ID
update(params) Update an agent
delete(params) Delete an agent

Appointment API (applite.app.multiService.appointment)

Method Description
list(params) List appointments
create(params) Create an appointment
get(params) Get appointment by ID
updateStatus(params) Update appointment status
assignAgent(params) Assign an agent to appointment
// Create an appointment
final appointment = await applite.app.multiService.appointment.create(
  CreateAppointmentParams(
    apiKey: 'your-api-key',
    appId: 'your-app-id',
    companyId: 'company-id',
    serviceId: 'service-id',
    customerId: 'customer-id',
    filledFields: {'notes': 'First time customer'},
    totalPrice: 25.00,
  ),
);

// Get appointment details
final detail = await applite.app.multiService.appointment.get(
  GetAppointmentParams(
    apiKey: 'your-api-key',
    appId: 'your-app-id',
    id: 'appointment-id',
  ),
);

// Update status
await applite.app.multiService.appointment.updateStatus(
  UpdateAppointmentStatusParams(
    apiKey: 'your-api-key',
    appId: 'your-app-id',
    id: 'appointment-id',
    status: AppointmentStatus.confirmed,
  ),
);

// Assign an agent
await applite.app.multiService.appointment.assignAgent(
  UpdateAppointmentAgentParams(
    apiKey: 'your-api-key',
    appId: 'your-app-id',
    id: 'appointment-id',
    agentId: 'agent-id',
  ),
);

Field Template API (applite.app.multiService.fieldTemplate)

Method Description
list(params) List field templates
create(params) Create a field template
update(params) Update a field template
delete(params) Delete a field template

Duticotac Module (applite.duticotac)

Balance and payment management for the Duticotac platform.

Balance API (applite.duticotac.balance)

Method Description
get(params) Get account balance
final balance = await applite.duticotac.balance.get(
  AppScopedParams(
    apiKey: 'your-api-key',
    appId: 'your-app-id',
  ),
);

Offer API (applite.duticotac.offer)

Method Description
list(params) List offers
create(params) Create an offer
get(params) Get offer by ID
update(params) Update an offer
delete(params) Delete an offer

Payment API (applite.duticotac.payment)

Method Description
initiate(params) Initiate a payment
verify(params) Verify a payment

Transaction API (applite.duticotac.transaction)

Method Description
list(params) List transactions
get(params) Get transaction by ID

Kolabo Module (applite.kolabo)

Partner and collaboration management.

App API (applite.kolabo.app)

Method Description
list(params) List Kolabo apps
getBySlug(slug, params) Get app by slug
get(slug, params) Get app details
configure(slug, params) Configure a Kolabo app
join(slug, params) Join a Kolabo app
final apps = await applite.kolabo.app.list(
  ApiKeyParams(apiKey: 'your-api-key'),
);

Customer API (applite.kolabo.customer)

Method Description
list(params) List customers
get(params) Get customer by ID

Partner API (applite.kolabo.partner)

Method Description
list(params) List partners
create(params) Create a partner
get(params) Get partner by ID
update(params) Update a partner

Super Admin Module (applite.superAdmin)

Platform administration APIs.

Auth API (applite.superAdmin.auth)

Method Description
init(params) Initialize super admin
signin(params) Sign in as super admin
me(params) Get current admin info
final admin = await applite.superAdmin.auth.signin(
  SuperAdminSigninParams(
    email: 'admin@example.com',
    password: 'password',
  ),
);

Apps API (applite.superAdmin.apps)

Method Description
list(params) List all apps
get(params) Get app by ID
update(params) Update an app

Modules API (applite.superAdmin.modules)

Method Description
list(params) List all modules
update(params) Update module settings

Stats API (applite.superAdmin.stats)

Method Description
get(params) Get platform statistics

Finance API (applite.superAdmin.finance)

Method Description
balance(params) Get platform balance
listTransactions(params) List platform transactions

Notification API (applite.superAdmin.notification)

Method Description
send(params) Send a notification
broadcast(params) Broadcast to all users

Maintenance Module (applite.maintenance)

Method Description
cronNotification(params) Run notification cron job
cronBilling(params) Run billing cron job
cleanupTransactions(params) Cleanup old transactions

UI Components

The SDK includes pre-built Flutter widgets for common flows.

Push Notifications

The AppliteNotificationService simplifies Firebase Cloud Messaging integration.

void main() async {
  WidgetsFlutterBinding.ensureInitialized();
  await Firebase.initializeApp();

  FirebaseMessaging.onBackgroundMessage(appliteFirebaseMessagingBackgroundHandler);

  await AppliteNotificationService().initialize(
    apiKey: "YOUR_API_KEY",
    appId: "YOUR_APP_ID",
    applite: appliteInstance,
    onNavigate: (payload) {
       router.push('/appointment/$payload');
    },
    onSaveToken: (token) async {
       await localStorage.setString('fcmToken', token);
    },
    onGetToken: () async {
       return localStorage.getString('fcmToken');
    },
    onRemoveToken: () async {
       await localStorage.remove('fcmToken');
    },
    onGetUser: () async {
       return currentUser;
    },
  );

  runApp(const MyApp());
}

Service Details Screen

Displays service information with dynamic form builder and handles appointment creation.

ServiceDetailsScreen(
  applite: appliteInstance,
  service: myServiceItem,
  user: currentUser,
  apiKey: "YOUR_API_KEY",
  appId: "YOUR_APP_ID",
  onAppointmentCreated: () {
    // Callback after successful booking
  },
  payAnOfferOption: PayAnOfferOption(
    localDB: myLocalDB,
    baseUrl: "https://api.myapp.com",
  ),
);

Address Management Screens

// List Addresses
AddressListScreen(
  applite: appliteInstance,
  user: currentUser,
  apiKey: "YOUR_API_KEY",
  appId: "YOUR_APP_ID",
);

// Address Picker
final selectedAddress = await Navigator.push(
  context,
  MaterialPageRoute(
    builder: (_) => AddressPickerScreen(
      applite: appliteInstance,
      user: currentUser,
      apiKey: "YOUR_API_KEY",
      appId: "YOUR_APP_ID",
    ),
  ),
);

Utility Widgets

  • ServiceFieldBuilder: Renders dynamic form fields based on service configuration
  • AddressFieldCard: A card widget to display and select an address

Error Handling

All API methods throw ApiException on failure:

try {
  await applite.app.customer.get(params);
} on ApiException catch (e) {
  print('Error: ${e.message}');
  print('Status code: ${e.statusCode}');
}

ApiException wraps DioException details when the underlying HTTP call fails or when the API responds with an error payload.


TypeScript Types

The SDK includes full Dart type definitions for all API responses:

import 'package:dart_sdk/applite_ui.dart';

// Types are available for all entities
Customer customer;
CustomerListItem listItem;
StoreOrder order;
MultiServiceAppointmentDetail appointment;