ponshu-room-lite/lib/providers/gemini_provider.dart

18 lines
672 B
Dart
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import 'package:flutter_riverpod/flutter_riverpod.dart';
import '../services/gemini_service.dart';
/// GeminiService のシングルトンプロバイダー
///
/// アプリ全体で同一インスタンスを共有する。
/// レート制限の状態_lastApiCallTimeがインスタンス間で共有されるため、
/// 複数画面から同時に呼び出しても連打防止が正しく機能する。
///
/// 使用例:
/// ```dart
/// final geminiService = ref.read(geminiServiceProvider);
/// final result = await geminiService.analyzeSakeLabel(paths);
/// ```
final geminiServiceProvider = Provider<GeminiService>((ref) {
return GeminiService();
});