brianegan/flutter_architecture_samples

Comments on the Vanilla example

Open

#72 opened on 2018年9月21日

GitHub で見る
 (3 comments) (0 reactions) (0 assignees)Dart (8,920 stars) (1,717 forks)batch import
enhancementgood first issue

説明

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!

コントリビューターガイド