Tensegritics / Tensegritics/ClojureDart

Add example flutter app for showcasing extension use (with hive)

Open
#233 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Clojure
Stars
1.6k
Forks
119
PR merge metrics
No merged PRs in 30d

Description

Translate the main Hive x Flutter example into CLJD, to provide a working example.
https://docs.hivedb.dev/#/basics/hive_in_flutter

(ns flutter-lab.main
  "ValueListenable example from hive documentation for Flutter: https://docs.hivedb.dev/#/basics/hive_in_flutter"
  (:require ["package:flutter/material.dart" :as m]
            ["package:hive/hive.dart" :as hive]
            ["package:hive_flutter/hive_flutter.dart" :as hive-flutter]
            [cljd.flutter :as f]))


(defn main []
  (-> hive-flutter/Hive hive-flutter/HiveX .initFlutter await)
  (-> hive/Hive (.openBox "pandorra"))

  (f/run
   (m/MaterialApp
    .title "Welcome to Flutter"
    .theme (m/ThemeData .primarySwatch m.Colors/pink))
   .home
   (m/Scaffold
    .appBar (m/AppBar
             .title (m/Text "Welcome to ClojureDart")))
   .body
   (#/(m/ValueListenableBuilder hive/Box)
    ;; something something breaks here
    .valueListenable (-> (.box hive/Hive "pandorra")
                         hive-flutter/Hive
                         .listenable)
    .builder
    (fn [ctx box widget]
      (m/Center
       .child
       (m/Switch
        .value (-> box (.get "darkMode" .defaultValue false))
        .onChanged (fn [v] (-> box (.put "darkMode" v)))))))))

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the linked Hive Flutter documentation and the provided ClojureDart snippet, then inspect the existing example-app structure and how ClojureDart handles Flutter interop. Resolve the marked ValueListenableBuilder issue and add a working Hive-backed Flutter example that demonstrates the documented behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
clojure, flutter
Domain
databases, mobile-dev
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.