koolbase_flutter 1.9.0 copy "koolbase_flutter: ^1.9.0" to clipboard
koolbase_flutter: ^1.9.0 copied to clipboard

Flutter SDK for Koolbase — feature flags, remote config, version enforcement, authentication, file storage, database, realtime subscriptions, and OTA updates for mobile apps.

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:koolbase_flutter/koolbase_flutter.dart';

void main() async {
  WidgetsFlutterBinding.ensureInitialized();

  await Koolbase.initialize(
    const KoolbaseConfig(
      publicKey: 'pk_live_6e4abe2ffba691e8e44093d9',
      baseUrl: 'https://api.koolbase.com',
      refreshInterval: Duration(seconds: 30),
    ),
  );

  final versionCheck = Koolbase.checkVersion();
  if (versionCheck.status == VersionStatus.forceUpdate) {
    runApp(ForceUpdateApp(message: versionCheck.message));
    return;
  }

  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    return const MaterialApp(title: 'Koolbase Example', home: HomeScreen());
  }
}

class HomeScreen extends StatelessWidget {
  const HomeScreen({super.key});

  @override
  Widget build(BuildContext context) {
    final showNewAuthFlow = Koolbase.isEnabled('new_auth_flow');
    final swapTimeout = Koolbase.configInt('swap_timeout_config', fallback: 30);
    final versionCheck = Koolbase.checkVersion();

    return Scaffold(
      appBar: AppBar(title: const Text('Koolbase Example')),
      body: Padding(
        padding: const EdgeInsets.all(16),
        child: Column(
          crossAxisAlignment: CrossAxisAlignment.start,
          children: [
            Text('Device ID: ${Koolbase.deviceId}'),
            Text('Payload Version: ${Koolbase.payloadVersion}'),
            const SizedBox(height: 16),
            Text('new_auth_flow enabled: $showNewAuthFlow'),
            Text('swap_timeout_config: ${swapTimeout}s'),
            const SizedBox(height: 16),
            if (showNewAuthFlow)
              ElevatedButton(
                onPressed: () {},
                child: const Text('New Auth Flow'),
              )
            else
              ElevatedButton(
                onPressed: () {},
                child: const Text('Legacy Auth Flow'),
              ),
            if (versionCheck.status == VersionStatus.softUpdate)
              Container(
                margin: const EdgeInsets.only(top: 16),
                padding: const EdgeInsets.all(12),
                color: Colors.amber[100],
                child: Text(
                  versionCheck.message.isNotEmpty
                      ? versionCheck.message
                      : 'A new version is available!',
                  style: const TextStyle(fontWeight: FontWeight.bold),
                ),
              ),
          ],
        ),
      ),
    );
  }
}

class ForceUpdateApp extends StatelessWidget {
  final String message;
  const ForceUpdateApp({super.key, required this.message});

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        body: Center(
          child: Padding(
            padding: const EdgeInsets.all(32),
            child: Column(
              mainAxisAlignment: MainAxisAlignment.center,
              children: [
                const Icon(Icons.system_update, size: 64, color: Colors.blue),
                const SizedBox(height: 16),
                const Text(
                  'Update Required',
                  style: TextStyle(fontSize: 24, fontWeight: FontWeight.bold),
                ),
                const SizedBox(height: 8),
                Text(
                  message.isNotEmpty
                      ? message
                      : 'Please update the app to continue.',
                  textAlign: TextAlign.center,
                ),
                const SizedBox(height: 24),
                ElevatedButton(
                  onPressed: () {},
                  child: const Text('Update Now'),
                ),
              ],
            ),
          ),
        ),
      ),
    );
  }
}
8
likes
130
points
536
downloads

Documentation

API reference

Publisher

unverified uploader

Weekly Downloads

Flutter SDK for Koolbase — feature flags, remote config, version enforcement, authentication, file storage, database, realtime subscriptions, and OTA updates for mobile apps.

Homepage
Repository (GitHub)
View/report issues

License

MIT (license)

Dependencies

archive, connectivity_plus, crypto, drift, drift_flutter, flutter, flutter_secure_storage, http, package_info_plus, path_provider, shared_preferences, uuid, web_socket_channel

More

Packages that depend on koolbase_flutter