When running dart run build_runner build --verbose
I get the following errors:
运行DART RUN BUILD_RUNNER BUILD--Verbose时,我收到以下错误:
[SEVERE] isar_generator on lib/ui/responsive/responsive_layout.dart:
This builder requires Dart inputs without syntax errors.
However, package:plant_monitor/ui/responsive/responsive_layout.dart (or an existing part) contains the following errors.
responsive_layout.dart:13:16: Expected a type name.
responsive_layout.dart:13:16: Expected to find '['.
responsive_layout.dart:13:16: Expected to find ':'.
And 9 more...
Try fixing the errors and re-running the build.
package:build_resolvers/src/resolver.dart 218:9 AnalyzerResolver.compilationUnitFor.<fn>
package:pool/pool.dart 127:28 Pool.withResource
package:source_gen/src/builder.dart 373:18 _hasAnyTopLevelAnnotations
package:source_gen/src/builder.dart 89:11 _Builder.build
[SEVERE] isar_generator on lib/ui/widgets/card_tags.dart:
This builder requires Dart inputs without syntax errors.
However, package:plant_monitor/ui/widgets/card_tags.dart (or an existing part) contains the following errors.
card_tags.dart:11:12: Expected an identifier.
card_tags.dart:16:12: Expected an identifier.
card_tags.dart:16:21: Expected a type name.
And 9 more...
Try fixing the errors and re-running the build.
package:build_resolvers/src/resolver.dart 218:9 AnalyzerResolver.compilationUnitFor.<fn>
package:pool/pool.dart 127:28 Pool.withResource
package:source_gen/src/builder.dart 373:18 _hasAnyTopLevelAnnotations
package:source_gen/src/builder.dart 89:11 _Builder.build
[FINE] isar_generator on lib/entities/user.dart:Running IsarCollectionGenerator - 1 of 2
[FINE] isar_generator on lib/entities/user.dart:Running IsarEmbeddedGenerator - 2 of 2
[FINE] isar_generator on lib/entities/plant.dart:Running IsarCollectionGenerator - 1 of 2
[FINE] isar_generator on lib/entities/plant.dart:Running IsarEmbeddedGenerator - 2 of 2
[FINE] isar_generator on lib/entities/image.dart:Running IsarCollectionGenerator - 1 of 2
[FINE] isar_generator on lib/entities/image.dart:Running IsarEmbeddedGenerator - 2 of 2
[INFO] Build:Running build completed, took 8.8s
[INFO] Build:Caching finalized dependency graph...
[INFO] Build:Caching finalized dependency graph completed, took 102ms
[SEVERE] Build:
Failed after 8.9s
The code each of these refers to are below:
这些代码中的每一个都指的是下面:
For:
用于:
responsive_layout.dart:13:16: Expected a type name.
responsive_layout.dart:13:16: Expected to find '['.
responsive_layout.dart:13:16: Expected to find ':'.
The code is (where column numbers are labeled with (HERE)):
代码为(其中列号用(此处)标记):
09 Widget build(BuildContext context) {
10 return LayoutBuilder(builder: (context, constraints) {
11 double width = constraints.maxWidth;
12 switch (width) {
13 case < (HERE)400:
14 return Body(screenType: ScreenType.mobile.index);
15 case < 600:
16 return Body(screenType: ScreenType.tablet.index);
17 default:
18 return Body(screenType: ScreenType.desktop.index);
19 }
20 });
21 }
For:
用于:
card_tags.dart:11:12: Expected an identifier.
card_tags.dart:16:12: Expected an identifier.
card_tags.dart:16:21: Expected a type name.
The code is (where column numbers are labeled with (HERE)):
代码为(其中列号用(此处)标记):
10 switch (days) {
11 case (HERE)== 0:
12 return Text(
13 "Today",
14 style: TextStyle(fontSize: fontSize),
15 );
16 case (HERE)> 1 && < (HERE)100:
17 . . .
18 }
Details
Dart SDK Version: 3.1.0
Flutter Version: 3.13.1
build_runner: 2.4.6
Platform: Windows 11
详细信息DART SDK版本:3.1.0颤动版本:3.13.1 Build_Runner:2.4.6平台:Windows 11
I tried searching the issue on google and looking through the issues under flutter's GitHub and Isar's Github, but there were no mentions of similar issues. I expect it to build because unless I'm a complete idiot my syntax is correct.
我试着在谷歌上搜索这一问题,并在Ffltter的GitHub和Isar的Github下查看了这些问题,但没有提到类似的问题。我希望它能够构建,因为除非我是个彻头彻尾的白痴,否则我的语法是正确的。
更多回答
Looks like isar_generator isn't using Dart 3 syntax properly? Maybe see github.com/isar/isar/issues/1288 ?
看起来ISAR_GENERATOR没有正确使用DART 3语法?或许可以查看githorb.com/isar/isar/Issues/1288?
我是一名优秀的程序员,十分优秀!