gemini_flutter 0.0.1+1 copy "gemini_flutter: ^0.0.1+1" to clipboard
gemini_flutter: ^0.0.1+1 copied to clipboard

A new Flutter package for easily using Gemini APIs in flutter projects

gemini_flutter #

A Flutter package to simplify the integration of Gemini APIs in your Flutter applications. Easily make calls to Gemini APIs by initializing the GeminiHandler and utilizing the provided functions.

Getting Started #

To use this package, follow the steps below:

  1. Add the gemini_flutter dependency to your pubspec.yaml file:

    dependencies:
      gemini_flutter: ^0.0.1+1
    

    Then, run flutter pub get to fetch the dependency.

  2. In your Dart code, import the package:

    import 'package:gemini_flutter/gemini_flutter.dart';
    
  3. Initialize the GeminiHandler in your main function:

    void main() {
      GeminiHandler().initialize(
        apiKey: "YOUR_API_KEY",
        temperature: 0.7,
        topK: 50,
        topP: 0.8,
        outputLength: 100,
      );
    
      runApp(MyApp());
    }
    

    Make sure to replace "YOUR_API_KEY" with your actual Gemini API key. You can also customize other parameters as needed.

Usage #

Text Generation #

TextOnlyResponseModel generateText(String prompt) {
  try {
    final response = GeminiHandler().textOnly(prompt);
    print("Generated Text: ${response.generatedText}");
    return response;
  } catch (e) {
    print("Error: $e");
    // Handle the error accordingly
    return TextOnlyResponseModel(error: "Failed to generate text");
  }
}
13
likes
0
pub points
63%
popularity

Publisher

verified publishertechypanther.com

A new Flutter package for easily using Gemini APIs in flutter projects

Homepage

License

unknown (license)

Dependencies

connectivity_plus, dio, flutter, logger

More

Packages that depend on gemini_flutter