2

I want do some code gen work with flutter.

I found flutter packages pub run build_runner build can do code gen work.

But in the document: https://pub.dartlang.org/packages/build_runner say: "build_runner can only run Builders that are published with a build.yaml file."

I want to known how to make a custom builder or anything else to gen dart code like json_serializable.

Thank you very much!

wudijimao
  • 25
  • 4

1 Answers1

-2

Why not just look at the source for that package? https://github.com/dart-lang/json_serializable

Randal Schwartz
  • 39,428
  • 4
  • 43
  • 70
  • I have seen this. But this is a "published" package, need to known how to use a local package. Do you have any links about this? Thank you. – wudijimao Feb 20 '19 at 04:54
  • I don't understand what you're missing. Look at the source code for `json_serializable`, and do the same thing locally. – Randal Schwartz Feb 20 '19 at 23:33
  • 2
    Now,I known my real don't know is: How to create a dart package in Android Studio. And How to use local dart package in Flutter project. After hard try on this: https://www.dartlang.org/guides/libraries/create-library-packages And this: https://stackoverflow.com/questions/30652422/how-to-develop-a-dart-library-locally. Finally Success!!! Thank you!! – wudijimao Feb 21 '19 at 08:00