无法让@Typeconverters在地颤中工作

问题描述

Documentation,我看到它应该受支持,但是我找不到将@TypeConverter添加到我的应用程序中的方法。我在任何地方都没有看到任何有效的示例或类似的问题,因此我开始认为我尚未添加任何东西或尚不可用。

这是我的pubspec.yaml文件,以防万一有人要求它:

version: 1.0.0+1

environment:
  sdk: ">=2.7.0 <3.0.0"

dependencies:
  Flutter:
    sdk: Flutter
  http: ^0.12.2
  provider: ^4.3.2+2
  intl: ^0.16.1
  shared_preferences: ^0.5.10
  json_annotation: ^3.1.0
  floor: ^0.14.0


  # The following adds the Cupertino Icons font to your application.
  # Use with the CupertinoIcons class for iOS style icons.
  cupertino_icons: ^0.1.3

dev_dependencies:
  floor_generator: ^0.14.0
  Flutter_test:
    sdk: Flutter
  json_serializable: ^3.5.0
  build_runner: ^1.0.0

解决方法

在您的 pubspec.yaml 文件中添加这一行

地板注释:^1.0.0