【 Flutter 】Flutter を 基礎 から 学習 ( アーキテクチャ ) part258 Reduxパターンのサンプル

基礎 から 学ぶ Flutter 」という書籍で  学習 したことを ブログでアウトプットしていこうと思います。今回は アーキテクチャ ( part258 )です。

前回

【 Flutter 】Flutter を 基礎 から 学習 ( アーキテクチャ ) part257 Reduxパターンとは

引き続き、アーキテクチャについて学びます。

Reduxパターンのサンプル

サンプルを入力して動きを確認してみたいと思います!

以下のようなビルドエラーになりました😇

/D:/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_redux-0.10.0/lib/flutter_redux.dart:474:31: Error: Method 'addPostFrameCallback' cannot be called on 'WidgetsBinding?' because it is potentially null.
 - 'WidgetsBinding' is from 'package:flutter/src/widgets/binding.dart' ('/D:/flutter/packages/flutter/lib/src/widgets/binding.dart').
Try calling using ?. instead.
      WidgetsBinding.instance.addPostFrameCallback((_) {
                              ^^^^^^^^^^^^^^^^^^^^
/D:/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_redux-0.10.0/lib/flutter_redux.dart:576:31: Error: Method 'addPostFrameCallback' cannot be called on 'WidgetsBinding?' because it is potentially null.
 - 'WidgetsBinding' is from 'package:flutter/src/widgets/binding.dart' ('/D:/flutter/packages/flutter/lib/src/widgets/binding.dart').
Try calling using ?. instead.
      WidgetsBinding.instance.addPostFrameCallback((_) {
                              ^^^^^^^^^^^^^^^^^^^^


FAILURE: Build failed with an exception.

* Where:
Script 'D:\flutter\packages\flutter_tools\gradle\flutter.gradle' line: 1102

* What went wrong:
Execution failed for task ':app:compileFlutterBuildDebug'.
> Process 'command 'D:\flutter\bin\flutter.bat'' finished with non-zero exit value 1

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 13s
Exception: Gradle task assembleDebug failed with exit code 1

最後に

Flutter SDKのバージョンがよくないのかなんなのかわからずギブアップです・・・。

しかし内容は理解できました。状態を管理する役割の1人がいて、その人が状態についてを方々に連絡しているということだと思います。

今日はここまで!