Inspiration

In today’s fast-paced information age, misinformation can spread within seconds—especially during live debates, presentations, or when examining claims embedded in images. I wanted to empower speakers, students, journalists, and everyday users to challenge falsehoods in real time. By combining Perplexity’s powerful Sonar API with Flutter’s cross-platform reach and Firebase’s real-time database, Fact Dynamics was born to bring on-the-fly fact-checking directly into your hands.


What It Does

  • Live Debate Mode Streams your speech, breaks it into bite-sized chunks, and submits each to Perplexity for instant claim verification.
  • Image Report Mode Accepts photos or URLs, extracts textual claims from images, and checks them against credible sources.
  • Structured Claim Output Displays each identified claim as a chat “bubble” with:

    • Rating: TRUE / FALSE / MISLEADING / UNVERIFIABLE
    • Explanation: One-sentence justification
    • Sources: Two curated URLs
  • Persistence & Playback All transcripts and fact-check results are stored in Firestore under users/{uid}/debates or .../images, so you can revisit or share your sessions.

  • Secure Auth & Sync Firebase Authentication (Google, Apple, Email) keeps your data private and synced across devices.


How We Built It

  1. Frontend
  • Flutter for a unified iOS, Android, and Web experience.
  • BLoC pattern to separate UI from business logic.

    1. Speech & Image Processing
  • speech_to_text package captures live audio.

  • Custom prompt engineering in assets/prompts/fact_checker_prompt.md instructs the Sonar API to extract and rate claims.

  • Base64 or URL-based image uploads via our ChatRequestModel.defaultImageRequest.

    1. Backend & Storage
  • Firestore schema stores each session under the authenticated user:

     users/{uid}/debates/{debateId}/transcriptions
                       /claims
     users/{uid}/images/{imageId}/claims
    
  • Batched writes ensure fast, atomic claim uploads.

    1. SDKs & Packages
  • Published perplexity_dart (Dart SDK) and perplexity_flutter (Flutter wrapper) for seamless API calls.

  • Environment variables managed via .env and dotenv for secure API key handling.


Challenges We Ran Into

  • Chunking Speech Finding the right word-count threshold (≈7 words) before triggering an API call to balance responsiveness and cost.
  • Streaming vs. Non-Streaming Handling partial JSON streams from Perplexity required accumulating chunks until valid JSON could parse.
  • Firestore Rules & Permissions Ensuring secure, user-scoped read/write rules while allowing real-time updates.

Accomplishments We’re Proud Of

  • Cross-Platform Consistency: One codebase powering mobile and web deployments.
  • Open-Source SDKs: Launched two packages on pub.dev—drastically lowering the barrier for other Dart/Flutter developers.
  • Real-Time UX: Sub-second fact feedback during live speech, a unique feature in the hackathon space.

What We Learned

  • The importance of prompt engineering: precise instructions yield cleaner, more structured JSON outputs.
  • Balancing streaming performance with API rate limits and cost.
  • Designing Firestore schemas for real-time collaborative scenarios.

What’s Next for Fact Dynamics

  • Collaborative Sessions: Multi-user debate rooms with shared transcripts and fact streams.
  • Video-Conference Plugins: Browser extensions or SDKs for Zoom/Meet integrations.
  • Offline Mode: Cache recent fact-checks for use without connectivity.
  • Analytics Dashboard: Visualize misinformation trends over time and across topics.

Thank you for checking out Fact Dynamics, we’re excited to bring truth back into every conversation!

Built With

Share this project:

Updates