FirebaseDatabase constructor
- required FirebaseAccount account,
- required String database,
- String basePath = '',
- Timeout? timeout,
- WriteSizeLimit? writeSizeLimit,
- Client? client,
Constructs a database for an authenticated user.
This constructor needs an account
and a database
. The account
is the
user account used to authenticate to the API, the database
is the name
of the database to connect to. If you want to connec to a database without
a user, use FirebaseDatabase.unauthenticated instead.
The database will reuse the Client
of the FirebaseAccount.api
, unless
client
is explicitly specified. Either one is used to create the api.
If the explicit client is a SSEClient, that one is used for the API.
Otherwise a wrapper is created around client
to provide the SSE
features.
By default, the database will connect to the root path of the server
database. If you want to connect to a subset of the database, use
basePath
to only connect to that part. This path will also be the path
of the rootStore.
In addition, you can use timeout
and writeSizeLimit
to configure the
corresponding values of the newly created RestApi.
Implementation
FirebaseDatabase({
required FirebaseAccount account,
required String database,
String basePath = '',
Timeout? timeout,
WriteSizeLimit? writeSizeLimit,
Client? client,
}) : this.api(
RestApi(
client: client ?? account.api.client,
database: database,
basePath: basePath,
idToken: account.idToken,
timeout: timeout,
writeSizeLimit: writeSizeLimit,
),
account: account,
);