Load account info, branches, wallet, and pricing.

flasho.account

flasho.account

bootstrap()

The recommended startup call. Returns everything in one request.

final data = await flasho.account.bootstrap();
 
print(data.account.sellerName);          // "My Restaurant"
print(data.account.walletBalance);       // "10.000"
print(data.account.billingMode);         // BillingMode.prepaid
print(data.scheduledDelivery.available); // true
print(data.branches.length);             // 3

💡 Use bootstrap at app startup

One call replaces separate calls to account, wallet, branches, and pricing.


get()

Returns the merchant profile as a MerchantAccount.

final account = await flasho.account.get();
print(account.sellerId);    // "M001"
print(account.billingMode); // BillingMode.prepaid

listBranches()

Returns all pickup branches as List<Branch>.

final branches = await flasho.account.listBranches();
final def = branches.firstWhere((b) => b.isDefault);
 
print(def.name);      // "Main Branch"
print(def.latitude);  // 29.3764
print(def.longitude); // 47.9785

getWallet()

Returns a WalletResponse with balance and recent transactions.

final wallet = await flasho.account.getWallet();
 
print(wallet.balance);     // "10.000"
print(wallet.billingMode); // BillingMode.prepaid
 
for (final tx in wallet.transactions) {
  print('${tx.type.name}: ${tx.amount} KWD — ${tx.reference}');
}

Transaction types: TransactionType.topup · TransactionType.debit · TransactionType.refund


getPricing()

Returns PricingResponse with distance tiers and special zones.

final pricing = await flasho.account.getPricing();
final config = pricing.effectiveConfig;
 
for (final tier in config.tiers) {
  print('${tier.label}: ${tier.priceKwd} KWD');
}
// Up to 10 km: 1.25 KWD
// Up to 15 km: 1.75 KWD
 
for (final zone in config.specialZones) {
  print('${zone.name}: ${zone.priceKwd} KWD');
}

getScheduledDeliverySettings()

Returns ScheduledDeliverySettings. Always call this before booking a scheduled delivery.

final settings = await flasho.account.getScheduledDeliverySettings();
 
if (!settings.available) {
  throw Exception('Scheduled delivery is not enabled on this account');
}
 
print(settings.surchargeKwd); // "2.000"