Dart client for Genkit: Call Genkit Flows from ...

Dart client for Genkit: Call Genkit Flows from Flutter/Dart

Nozomi Koborinai

July 06, 2025

Annual Pro sale · Save $30

Have presentations of your own?

Share with private links, password protection, and more control over your work.

Transcript

9 slides
  1. Dart client for Genkit Call Genkit Flows from Flutter/Dart Nozomi

    Koborinai Google Cloud Partner Top Engineer (Serverless App Development) 2025
  2. What is ? A server-side framework for AI applications, built

    by the Google Firebase team Define and run AI Flows directly on the server Enhanced observability for AI workflows Optimized for building AI application backend logic
  3. Future<String> generateImage({required String description}) async { try { final response

    = await dio.post( 'https://your-genkit-endpoint.com/generateImage', data: { 'data': { 'imageDescription': description, }, }, ); if (response.statusCode == 200) { return response.data['result']['url'] as String; } throw Exception('Failed to generate image: ${response.statusCode}'); } on DioException catch (e) { throw Exception('Failed to generate image: ${e.message}'); } } Calling Genkit from Dart Previous Challenges Boilerplate for HTTP Requests and JSON (De)serialization Challenging Manual Implementation of Streaming (SSE) Steep Learning Curve for Genkit Server-Side Specifics
  4. Using the Dart client for Genkit // 1. Define the

    remote action for the Genkit endpoint, // specifying its URL and response type. final action = defineRemoteAction( url: 'https://your-genkit-endpoint.com/generateImage', fromResponse: (data) => MyOutput.fromJson(data), ); final input = MyInput(message: 'Hello Dart Genkit!', count: 10); try { // 2. Call the defined remote action. final output = await action(input: input); print('Flow Response: ${output.reply}, ${output.newCount}'); } catch (e) { print('Error calling flow: $e'); }
  5. Google I/O Extended 25 Proprietary & Confidential Key Features Type-Safe

    & Reusable Actions Built-in Streaming (Server-Sent Events) Support Genkit official client library

More Decks by Nozomi Koborinai

Other Decks in Programming