brianegan/flutter_architecture_samples

Comments on the Vanilla example

Open

#72 aperta il 21 set 2018

Vedi su GitHub
 (3 commenti) (0 reazioni) (0 assegnatari)Dart (1717 fork)batch import
enhancementgood first issue

Metriche repository

Star
 (8920 star)
Metriche merge PR
 (Nessuna PR mergiata in 30 g)

Descrizione

A couple of comments.

  1. The vanilla sample is too complex for a flutter/dart beginner. The discussion located at flutter_architecture_samples/example/vanilla/ is useful in explaining how flutter can implement inter-widget communications out of the box. However, IMHO it is extraordinarily complex. It has pieces scattered all over the directory structure. Is there a simpler example? Somewhere you wrote that for multiple state values, I might try a Map. Vanilla was the closest example I could find. The example at https://medium.com/@maksimrv/reactive-app-state-in-flutter-73f829bcf6a7 is fine for a single state value but offers no help with multiple values.

  2. The following code (from flutter_architecture_samples-master\example\vanilla\lib\models.dart) presumably (from its name) toggles the value of the complete member of each TodoEntry

  void toggleAll() {
    final allCompleted = this.allComplete;

    todos.forEach((todo) => todo.complete = !allCompleted);
  } 

Why is allCompleted invoked? Why doesn't the code read

todos.forEach((todo) => todo.complete = !todo.complete);

If that was not what was intended, then the method's name should changed or a /// comment added preceding the declaration.

Kudos: Thank you for your teaching efforts. It is fantastic work!

Guida contributor