> ## Documentation Index
> Fetch the complete documentation index at: https://docs.larksh.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Flutter SDK

> Use the Firebase Flutter SDK with Lark

Point your Firebase Flutter SDK at Lark by passing your Lark URL to `FirebaseDatabase.instanceFor()`. Everything else (listeners, writes, queries) works without changes.

## Setup

Add the Realtime Database plugin to your `pubspec.yaml`:

```yaml theme={null}
dependencies:
  firebase_core: ^3.0.0
  firebase_database: ^11.0.0
```

Then run:

```bash theme={null}
flutter pub get
```

## Connect to Lark

Pass your Lark URL when getting the database instance:

```dart theme={null}
import 'package:firebase_core/firebase_core.dart';
import 'package:firebase_database/firebase_database.dart';

await Firebase.initializeApp();

// Change this from https://PROJECT_ID.firebaseio.com
final database = FirebaseDatabase.instanceFor(
  app: Firebase.app(),
  databaseURL: 'https://your-lark-project-id.larkdb.net',
);

final ref = database.ref('players/alice');
```

If your `firebase_options.dart` (generated by FlutterFire CLI) already has the `databaseURL`, you can update it there instead and use `FirebaseDatabase.instance` directly.

## Database routing

If your Firebase app stores many independent data silos under path prefixes (game rooms, workspaces, etc.), see [Database routing](/firebase/database-routing) for options on splitting them into separate Lark databases.
