Skip to main content

Overview

Pub Version

CloudBase Flutter SDK enables you to use CloudBase capabilities in Flutter applications, including authentication, document database, data models, MySQL database, cloud functions, CloudBase Run, APIs, and Cloud Storage. The current version is 1.3.0, supporting Android, iOS, Web, macOS, Linux, and Windows. For usage, please refer to CloudBase Flutter SDK, or check the sample code.

Installation​

Add the dependency in pubspec.yaml:

dependencies:
cloudbase_flutter: ^1.3.0

Then run:

flutter pub get

SDK is categorized by functionality:

  • Authentication: API methods for user registration and login, supporting multiple login methods.
  • Session Management: API methods for managing user session state and tokens.
  • User Management: API methods for retrieving, updating, and managing user information.
  • Identity Source Management: API methods for managing third-party identity source binding and unbinding.
  • Password Management: API methods for password reset and change.
  • Verification Management: API methods for verification code sending, verification, resending, CAPTCHA creation, verification, and management.
  • Document Database: Operations for NoSQL document database including collections, documents, queries, updates, deletions, aggregation, transactions, and more.
  • Cloud Functions: Call cloud functions and function-type cloud hosting.
  • Cloud Hosting: Call cloud hosting container services.
  • Cloud Storage: Upload, download, delete, copy, move, list, and signed URLs inside a PG mode bucket. Classic mode is documented in Classic Cloud Storage.

Basic Usage Example​

accessKey can be generated in CloudBase Platform/API Key Configuration


// Initialize (async)
final app = await CloudBase.init(
env: 'your-env-id', // Replace with your environment ID (required)
region: 'ap-shanghai', // Region, default ap-shanghai; also ap-guangzhou, ap-singapore
lang: 'zh-CN', // Language, default zh-CN; also en-US
accessKey: 'your-key', // Fill in the generated Publishable Key
authConfig: AuthConfig(
detectSessionInUrl: true, // Optional: automatically detect OAuth parameters in URL
),
debug: false, // Optional, default false. When true, print the request and response body
// captchaConfig: CaptchaConfig(navigatorKey: navigatorKey), // Optional: built-in captcha dialog
);

final auth = app.auth;

CloudBase.init parameters:

ParameterTypeRequiredDescription
envStringYesCloudBase environment ID
regionStringNoRegion, default ap-shanghai; options: ap-guangzhou, ap-singapore
langStringNoLanguage, default zh-CN; options: en-US
accessKeyStringNoPublishable Key for anonymous access to public resources
authConfigAuthConfigNoAuthentication configuration, such as detectSessionInUrl
captchaConfigCaptchaConfigNoCaptcha configuration; set navigatorKey to use the built-in dialog
debugboolNoWhen true, print the request body, response headers, and response body. Default is false