This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
String createMoveExplanationPrompt(String playerName, Move move, int currentScore) { | |
return ''' | |
You are an enthusiastic Scrabble commentator. | |
Explain this move by $playerName: | |
- Word: ${move.word} | |
- Score for this move: ${move.score} points | |
- Tiles placed: ${move.tiles.map((t) => '${t.letter}(${t.points})').join(', ')} | |
- Current total after this move: $currentScore |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
String _constructImageComparisonPrompt(Map<String, dynamic> previousState) { | |
return ''' | |
Compare these two Scrabble board images: the first is the previous state, the second is after a move. | |
Identify ONLY new letters that appear in the second image. | |
Previous board state for reference: | |
${jsonEncode(previousState)} | |
Return ONLY a JSON object in exactly this format: | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class GameStateProvider with ChangeNotifier { | |
// Real-time board state sync | |
Stream<BoardState> getBoardState() { | |
return FirebaseService().getBoardState(sessionId); | |
} | |
// Move processing | |
Future<void> processMove(Move move) { | |
// AI analysis & validation | |
// Score calculation |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class AIService { | |
final LLMService _llmService; | |
bool _isTtsInitialized = false; | |
Future<String> generateMoveExplanation( | |
String playerName, | |
Move move, | |
int currentScore, | |
) async { | |
final prompt = ''' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class GeminiService { | |
late GenerativeModel _model; | |
final ImageStorageService _imageStorage = ImageStorageService(); | |
final FirebaseService _firebaseService = FirebaseService(); | |
GeminiService() { | |
// Initialize with Gemini 2.0 Flash | |
_model = FirebaseVertexAI.instance | |
.generativeModel(model: 'gemini-2.0-flash'); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Dart & Flutter - Training | |
* Workshop: Advanced Dart Programming - HTTP Requests, Streams, and Mixins | |
* Copyright (Boris-Wilfried Nyasse) | |
* All rights reserved | |
* | |
* Workshop Goals and Objectives: | |
* - Implement HTTP requests to fetch data from an external API. | |
* - Use mixins for data formatting. | |
* - Understand and utilize streams for asynchronous data processing. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Dart & Flutter - Training | |
* Workshop: Advanced Dart Programming - HTTP Requests, Streams, and Mixins | |
* Copyright (Boris-Wilfried Nyasse) | |
* All rights reserved | |
* | |
* Workshop Goals and Objectives: | |
* - Implement HTTP requests to fetch data from an external API. | |
* - Use mixins for data formatting. | |
* - Understand and utilize streams for asynchronous data processing. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:flutter/material.dart'; | |
import 'dart:math'; | |
void main() => runApp(const MyApp()); | |
class MyApp extends StatelessWidget { | |
const MyApp({Key? key}) : super(key: key); | |
@override | |
Widget build(BuildContext context) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:flutter/material.dart'; | |
import 'dart:math'; | |
void main() => runApp(const MyApp()); | |
class MyApp extends StatelessWidget { | |
const MyApp({Key? key}) : super(key: key); | |
@override | |
Widget build(BuildContext context) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Dart & Flutter - Training | |
* | |
* Copyright (c) Boris-Wilfried Nyasse | |
* All rights reserved | |
* | |
*/ | |
// Define a class 'Adder' that behaves like a function. | |
class Adder { |
NewerOlder