cloudbase_flutter 1.0.4 copy "cloudbase_flutter: ^1.0.4" to clipboard
cloudbase_flutter: ^1.0.4 copied to clipboard

Tencent CloudBase Flutter SDK for authentication, cloud functions, cloud run, and API gateway integration.

example/example.dart

import 'package:cloudbase_flutter/cloudbase_flutter.dart';

void main() async {
  // Initialize CloudBase
  final app = await CloudBase.init(
    env: 'your-env-id',
    region: 'ap-shanghai',
    accessKey: '',
  );

  // Sign in with email and password
  final signInResult = await app.auth.signInWithPassword(
    SignInWithPasswordReq(
      email: 'user@example.com',
      password: 'your-password',
    ),
  );
  print('Signed in: ${signInResult.data?.user?.email}');

  // Get current session
  final sessionResult = await app.auth.getSession();
  if (sessionResult.data?.session != null) {
    print('User logged in: ${sessionResult.data?.user?.id}');
  }

  // Call cloud function
  final functionResult = await app.callFunction(
    name: 'myFunction',
    data: {'key': 'value'},
  );
  print('Function result: ${functionResult.result}');

  // Call cloud run service
  final containerResult = await app.callContainer(
    name: 'my-service',
    path: '/api/hello',
    method: HttpMethod.get,
  );
  print('Container response: ${containerResult.result}');

  // Sign out
  await app.auth.signOut();
}
0
likes
160
points
204
downloads

Publisher

unverified uploader

Weekly Downloads

Tencent CloudBase Flutter SDK for authentication, cloud functions, cloud run, and API gateway integration.

Homepage

Topics

#cloudbase #tencent-cloud #authentication #serverless #cloud-functions

Documentation

API reference

Funding

Consider supporting this project:

cloud.tencent.com

License

MIT (license)

Dependencies

dio, flutter, shared_preferences, uuid

More

Packages that depend on cloudbase_flutter