ClojureDart: Error while host-compiling (ns samples.tables (:require ["package:flutter/material.dart" :as m] [cljd.flutter.alpha as f]))

Viewed 47

Here is the trace:

Something horrible happened! :scream: Error while host-compiling (ns samples.tables "Faithful port of https://docs.flutter.dev/cookbook/design/tabs" (:require ["package:flutter/material.dart" :as m] [cljd.flutter.alpha as f])) (ns samples.tables "Faithful port of https://docs.flutter.dev/cookbook/design/tabs" (:require ["package:flutter/material.dart" :as m] [cljd.flutter.alpha as f])) Can't resolve widgets/InheritedModel (no source location)

And here is my code:

(ns samples.tabs
  "Faithful port of https://docs.flutter.dev/cookbook/design/tabs"
  (:require
   ["package:flutter/material.dart" :as m]
   [cljd.flutter.alpha as f]))

(defn main
  []
  (let [title "Tabs Demo"]
    (m/runApp
     (m/MaterialApp
      :title title
      :home
      (m/DefaultTabController
       :length 3
       :child 
       (m/Scaffold
        :appBar 
        (m/AppBar
         :bottom
         (m/TabBar 
          :tabs [(m/Tab :icon (m/Icon. m.Icons/directions_car)),
                 (m/Tab :icon (m/Icon. m.Icons/directions_transit)),
                 (m/Tab :icon (m/Icon. m.Icons/directions_bike))]))
        :body 
        (m/TabBarView 
         :children [(m/Tab :icon (m/Icon. m.Icons/directions_car)),
                    (m/Tab :icon (m/Icon. m.Icons/directions_transit)),
                    (m/Tab :icon (m/Icon. m.Icons/directions_bike))])))))))

We can notice that the trace mention all of the declaration of the module and the requirements, but is not very explicit either. You could also think that there is a problem with the widget library.

1 Answers

First, make sure you have

dependencies:
  flutter:
    sdk: flutter

in your pubspec.yaml ; it is used for clojureDart to find flutter librairies. If no, add it, remove the .clojuredart folder, run flutter pub get and t

You can see that the error occurs at the beginning of the file, with the requirements. Actually, I just forgotten to add : to the keyword :as.

[cljd.flutter.alpha as f] -> [cljd.flutter.alpha :as f]

Related