【问题标题】:ClojureDart: Class ... has no instance method 'call'ClojureDart:类...没有实例方法“调用”
【发布时间】:2022-06-14 23:58:26
【问题描述】:

我遇到了这个错误。 我有一个 Size 对象,我想得到它的高度和宽度。在我的 clojureDart 代码中,我做了:

(.height size)

在 Dart 中给出了:

(size.height() as double)

如何访问这个我知道不是函数/方法的属性?

顺便说一句,我收到了这些警告:

Stern warning: can't resolve member height on target type dynamic of library dart:core at line: 25, column: 42, file: ifs/main.cljd
Stern warning: can't resolve member width on target type dynamic of library dart:core at line: 25, column: 57, file: ifs/main.cljd

【问题讨论】:

    标签: flutter dart clojure


    【解决方案1】:

    好的,我应该指定我的变量大小是什么类型。 像这样:

    (defn transform [pic n ^m/Size size]
      ...
      (.height size))
    

    没有警告也没有错误!

    【讨论】:

      猜你喜欢
      • 2021-10-02
      • 2021-05-04
      • 2020-12-19
      • 1970-01-01
      • 1970-01-01
      • 2023-03-30
      • 2021-01-07
      • 2010-09-06
      • 2012-07-04
      相关资源
      最近更新 更多