技术小黑屋

Flutter 处理 Error Setter Not Found AsciiChar 问题

当我们进行了 flutter 升级后,有时候运行程序会发现无法编译,出现下面这样的错误

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
[        ] [   +2 ms] ../../../../.pub-cache/hosted/pub.flutter-io.cn/cached_network_image-3.2.0/lib/src/image_provider/multi_image_stream_completer.dart:152:22: Warning: Operand of null-aware operation '?.' has
type 'SchedulerBinding' which excludes null.
[        ] [        ]  - 'SchedulerBinding' is from 'package:flutter/src/scheduler/binding.dart' ('../../../../code/flutter_3/packages/flutter/lib/src/scheduler/binding.dart').
[        ] [        ]     SchedulerBinding.instance?.scheduleFrameCallback(_handleAppFrame);
[        ] [        ]                      ^
[ +402 ms] [ +414 ms] ../../../../.pub-cache/hosted/pub.flutter-io.cn/win32-2.3.1/lib/src/structs.g.dart:554:31: Error: Member not found: 'UnicodeChar'.
[        ] [        ]   int get UnicodeChar => Char.UnicodeChar;
[        ] [        ]                               ^^^^^^^^^^^
[        ] [        ] ../../../../.pub-cache/hosted/pub.flutter-io.cn/win32-2.3.1/lib/src/structs.g.dart:555:38: Error: Setter not found: 'UnicodeChar'.
[        ] [        ]   set UnicodeChar(int value) => Char.UnicodeChar = value;
[        ] [        ]                                      ^^^^^^^^^^^
[        ] [        ] ../../../../.pub-cache/hosted/pub.flutter-io.cn/win32-2.3.1/lib/src/structs.g.dart:557:29: Error: Member not found: 'AsciiChar'.
[        ] [        ]   int get AsciiChar => Char.AsciiChar;
[        ] [        ]                             ^^^^^^^^^
[        ] [        ] ../../../../.pub-cache/hosted/pub.flutter-io.cn/win32-2.3.1/lib/src/structs.g.dart:558:36: Error: Setter not found: 'AsciiChar'.
[        ] [        ]   set AsciiChar(int value) => Char.AsciiChar = value;
[        ] [        ]                                    ^^^^^^^^^

对于这种问题,解决起来也比较简单,执行

1
flutter pub upgrade




快来解锁最新版 Typora,新用户券后仅需 84 元!
如何便宜的购买 office 365 ?
新版赤友 NTFS 助手来袭,正版超低价