flutterdartpackagedart-packages

How to correctly organize multiple examples on a dart package


Given a dart package organized as follow

/example
|_______/foo
|________________/pubspec.yaml (and stuff)
|________________/main.dart
|_______/baz
|________________/pubspec.yaml (and stuff)
|________________/main.dart
/lib
|_______/foo
|________________/foo.dart
|_______/baz
|________________/baz.dart
/test
|_______/foo
|________________/foo_test.dart
|_______/baz
|________________/baz_test.dart

but pub.dev gives me

0/10 points: Package has an example
> No example found.
See package layout guidelines on how to add an example.

but I didn't find the documentation very helpful concerning my case

which brings me to the question in the title:

How to correctly organize multiple examples on a dart package?


Solution

  • You can add a README.md file inside your example folder, as flutter_mobx package.

    look: https://pub.dev/packages/flutter_mobx/example