Do you use the flutter/samples repo?

Howdy all. In the near future, I’m going to make some major changes to the flutter/samples repository. Before I do anything crazy, I wanted to get community feedback.

One of the major changes I’m making is streamlining the samples that exist. This includes deprecating a fair number of samples. I created this github issue that outlines these changes.

edit: There are other changes I’m planning on making that aren’t in that ticket, like adding support to open each sample as an IDX template, migrating to pub workspaces, and replacing the visual samples index with a samples index on flutter.dev. I’ll share those updates as I have them, as well.

Let me know your thoughts!

7 Likes

I’ve browsed the repo in the past but I do find it frustrating that you need to clone the entire repo when the majority of the time I’m only interested in one particular sample.

Why was the decision to place all the samples in one repo?

A suggestion for the website

Instead of showing screenshots for each of the samples it’d be great if you could use flutter_embedding to have the sample itself useable in the website

4 Likes

@ericwindmill I most definitely use the flutter/samples repo.

I’d like to figure out what makes a useful sample and what makes a bad sample. Are there any specific samples that you can recall being particularly useful?

Hi! I’m glad to see the efforts being made these days to improve various samples and documents for us. Thank you so much.

TBD

  • simplistic_editor - important, but way complex

This is the one I would miss the most. It is complex and not what the majority of people often need, but would be necessary for anyone trying to do similar complex things. I don’t think I can implement the same widget without refering to it when I feel like creating a custom editor in the future. Although it would be even better if it could be improved to be less complex, I guess the complexity is something inevitable to achieve the features, and so it is fine to have it as is.

Just wanted to clone the new compass sample and really didn’t like to have to clone the full samples folder

Yeah, that’s the biggest issue with DX of the samples repo. GitHub doesn’t off a clean way to download subdirectories, unfortunately. I’ve considered some workarounds, but they all have major downsides. If you have ideas, please let me know.

Cc @filip, who’s also tried to solve this problem.

1 Like

My imperfect solution is pkg:sample_downloader.

sample_downloader_demo-2

You can just run

$ dart pub global activate sample_downloader

to install it. Then run sample_downloader. By default, it looks for samples in the flutter/games repo.

You can ask it to parse any other github repository with something like sample_downloader --from some_org/some_repo.

Unfortunately, when you try to do this with flutter/samples, it kind of breaks the user experience becase there’s just so many samples there (43 at this moment). For that reason, a) the flutter/samples repo takes many seconds to parse, b) the primitive CLI menu doesn’t really work with so many options and I stopped short of making the CLI UX nicer.

It’s still better than the experience without sample_downloader, imho, when you want to check out just a single sample. But it’s hard to recommend it publicly.

Feedback, and especially Pull Requests, welcome.

3 Likes

Looking over your github issue, definitely think you’re on the right track:

  • Excellent idea to separate quickstarts and full demos. I’ve been trying to figure out best practices for directory structure and it can get confusing which sample to use as a template (found the post on the compass app which was very helpful)
  • Regarding AI, I think samples are going to stay relevant for a good while as trust builds. Quality >> quantity, keep it to a number of samples that can be well maintained
  • I appreciate having a few lines in the main.dart header stating what the sample is, what it is useful for, what it is not useful for, and what piece of the code is most important to start looking at

Thanks for doing this and good luck!

1 Like