FirebaseAI class
Entry point mirroring FirebaseAI from package:firebase_ai.
Only the Live API is provided, and Firebase app setup is replaced by an
API key. Moving from firebase_ai means replacing Firebase.initializeApp()
with FirebaseAI.initialize; everything after FirebaseAI.googleAI()
stays the same.
FirebaseAI.initialize(apiKey: 'YOUR_GEMINI_API_KEY');
final model = FirebaseAI.googleAI().liveGenerativeModel(
model: 'gemini-2.5-flash-native-audio-preview-12-2025',
liveGenerationConfig: LiveGenerationConfig(
responseModalities: [ResponseModalities.audio],
),
);
final session = await model.connect();
Constructors
- FirebaseAI.forTesting(LiveService liveService)
-
Builds an instance over a preconfigured core service, for tests.
factory
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
liveGenerativeModel(
{required String model, LiveGenerationConfig? liveGenerationConfig, List< Tool> ? tools, Content? systemInstruction}) → LiveGenerativeModel - Create a LiveGenerativeModel for real-time interaction.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
googleAI(
{String? apiKey, String? apiVersion}) → FirebaseAI - Returns an instance that talks to the Gemini Developer API.
-
initialize(
{required String apiKey, String? apiVersion}) → void - Sets the API key used by googleAI when none is passed.