Fork me on GitHub
#matrix
<
2023-05-24
>
kennytilton11:05:31

Flutter/MXers:

Lazy defs
defs are not initialized in order but lazily on a by-need basis. This is a consequence of Dart tree-shaking and fast startup goals.
-- https://github.com/Tensegritics/ClojureDart/blob/main/doc/differences.md#lazy-defs

kennytilton16:05:02

Hmmm, found a place I def'ed a widget, in the sandbox x08-navigation example:

(def second-route
  (fx/scaffold
    {:appBar (fx/app-bar {:title (fx/text "Second Route")})}
    (fx/center
      (fx/elevated-button
        {:onPressed (fx/in-my-context [me ctx]
                      (fx/->CBAsIs
                        (fn ^void []
                          (fx/ctx-page-pop ctx)
                          nil)))}
        (m/Text "Go back!")))))
Converting to a defn and then having it called seems to work fine. A simplifying difference is that second-route is never offered as a child widget, :thinking_face: