brianegan/flutter_architecture_samples

Comments on the Vanilla example

Open

#72 geöffnet am 21. Sept. 2018

Auf GitHub ansehen
 (3 Kommentare) (0 Reaktionen) (0 zugewiesene Personen)Dart (1.717 Forks)batch import
enhancementgood first issue

Repository-Metriken

Stars
 (8.920 Stars)
PR-Merge-Metriken
 (Keine gemergten PRs in 30 T)

Beschreibung

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!

Contributor Guide