Bloc: Proposition for some improvements over the examples

Created on 24 Jan 2019  路  5Comments  路  Source: felangel/bloc

First, I want to thank you for your great job. Nevertheless I want to share my experience trying to learn from you example projects.

  1. A get package over pubspec.yaml inside flutter_github_search outputs:
    Because every version of flutter_test from sdk depends on meta 1.1.6 and every version of common_github_search from path depends on meta ^1.1.7, flutter_test from sdk is incompatible with common_github_search from path. ... pub get failed (1).

*If I edit pubspec.yaml inside ../common_github_search and change for meta 1.1.6, the get packages works... I think.

Solution: Maybe talk about it in the README, eg how to upgrade flutter to meta 1.1.7, if not possible maybe not 'metaying' to bleeding edge...)

  1. If I open flutter_github_search (vsc or android studio) everything referencing -> import 'package:common_github_search/common_github_search.dart'; cannot be seen. Seems logical to me, common_github_search.dart is located upward.

Ok then what about I open one up, github_search? Dear god, vsc is choking like there is no tomorrow.

Solution: Maybe talk about it in the README, eg. what is to be done to handle this 'exotic' project arrangement: for a toy example project this is arguably 'unwelcoming'. I still haven't found how to run this one...

  1. If possible, for a future demo, I would tone down the 'abstractions' around the exemplification of your bloc pattern library. The github search example is great as it demos network calls but it is threaded with what I would call didactic noise, eg heavy wrapping in classes (that I suspect could be slimmed out), a lot of redirection through 'one class one file', helper functions etc. From a newcomer perspective, I just want to understand the 'core' mechanics of your lib (bloc pattern, BlocBuilder, events, state, your bloc interface etc) for relatively complex tasks, eg rest call handling. Everything around that is just potentially tripping wire. I get it its bread and butter for someone acquainted with flutter, but for a total newcomer it feels heavy. My two cents.

Thx for your time and concern,
ohenley

question

All 5 comments

Hi @ohenley thanks so much for the positive feedback and for the detailed descriptions of your experience with the examples.

I have addressed parts 1 and 2 in #68 馃憤

Please try the steps in the README and let me know if you are still having problems running the project.

Regarding part 3 (toning down the abstractions) can you be a bit more specific? I was trying to have a combination of simple examples of how to use the library as well as more advanced ones for people looking for how to use this in a production application.

Thanks again for opening this!

Hi @felangel.

Concerning the new readme:
... still some hiccups ...
a) using the terminal inside VSC on windows the && are not recognized by PowerShell. I went further using the git bash windows prompt because here they work.
b) when you have the flutter sdk, 'pub' is not recognized (dart only?). I tried 'flutter pub' instead and it worked... I think, because I have no way to know if all the deps are fine. The command completes though.
c) Still after the 3 cmds, the project can not find:
import 'package:common_github_search/common_github_search.dart';
My setup is happy when I replace by:
import '../../common_github_search.dart';

I am new to VSC also. Indications on how to make package:common_github_search a reality would be welcomed.

Concerning the tuning down of the example. Bah, its fine, just IMO the best would be to have a tricky example like live REST data but bare minimum, not production ready for people wanting to bridge. Eg. the whole demo fits in two files. main.dart and my_bloc.dart. In my_bloc.dart you declare the Events, the States then the MyBloc implementation with some didactic comments in between. Voila! I find your 'wrapping' of the pattern great because it is conceptually 'strict'. Events in, business logic, states out. That is what I want to get from the example, then I get a 'wow' moment.

Keep up the good work man!

Hey @ohenley I just updated the README again based on your comments. I think you should try installing the Dart SDK in addition to Flutter and try again. The fact that package:common_github_search is not being found means that either the pub get in common_github_search isn't working properly or the flutter packages get in flutter_github_search isn't succeeding.

Can you confirm that both run successfully? I believe you should see an exit code 0 if all goes well.

Regarding the example I think you make a great point and I'll separate the tutorials into beginner/intermediate/advanced and include variations of each project so that there is a smaller barrier to entry like you mentioned. In addition, I'm planning on posting a set of video tutorials on how to get started using bloc which should hopefully help even more.

Thanks again for your feedback, it's super helpful and let me know if you're able to get the example to run properly.

If you're still having issues it'd be helpful to have you include the output of:

  • flutter doctor --verbose
  • pub get in common_github_search
  • flutter packages get in flutter_github_search.

1) Using windows cmd, everything works. With an Android device plugged in, 'flutter run' launches np.

2) The project dependencies inside VSC are still 'mayhem'. I cannot resolve eg:
import 'package:common_github_search/common_github_search.dart'

Like can be seen in the screenshot, If I start typing 'package:common I am offered package:common_github_search but not the associated dart file needed.

Also you can see that the common_github_search folder files themselves do not recognize the import:
import 'package:common_github_search/common_github_search.dart'

I tried to rebuild the pub cache, restart VSC, nothing is doing it. Maybe you could just import from relative path everywhere.

3) Explaining the mapping from what Tensor is doing and your lib would be great. https://www.youtube.com/watch?v=2N75m6Pq9eY&list=PLJbE2Yu2zumDqr_-hqpAN0nIr6m14TAsd&index=70

Thx.

Note, I wont have much time anymore to try to fix the path dependencies clog... sorry. Its is not your fault but the whole 'pub' state of affairs is getting to my nerves. The more I read about it the more I am pissed. I suggest you make a clean clone on a windows 10 machine and check for yourself if you want to stick with this 'include' configuration.
screenshot 63

@ohenley thanks for the update! I鈥檒l close this for now and when I am able to get access to a windows 10 machine I鈥檒l try to reproduce this and will post an update.

Thanks for the advice (3) and I鈥檒l keep everything in mind as I鈥檓 adding/enhancing the documentation. You鈥檙e feedback has been incredibly helpful! 馃憤馃挴

Was this page helpful?
0 / 5 - 0 ratings

Related issues

nerder picture nerder  路  3Comments

rsnider19 picture rsnider19  路  3Comments

hivesey picture hivesey  路  3Comments

Reidond picture Reidond  路  3Comments

MahdiPishguy picture MahdiPishguy  路  3Comments