英文:
Error: The non-abstract class 'S' is missing implementations for these members:
问题
Error: 非抽象类'S'缺少以下成员的实现:
i18n.dart:11
- WidgetsLocalizations.reorderItemDown
- WidgetsLocalizations.reorderItemLeft
- WidgetsLocalizations.reorderItemRight
- WidgetsLocalizations.reorderItemToEnd
- WidgetsLocalizations.reorderItemToStart
- WidgetsLocalizations.reorderItemUp
请尝试以下操作之一: - 提供一个实现,
- 继承自超类或混入类的实现,
- 将该类标记为抽象类,
- 提供'noSuchMethod'的实现。
class S implements WidgetsLocalizations {
^
/C:/flutter/packages/flutter/lib/src/widgets/localizations.dart:173:14: 上下文: 'WidgetsLocalizations.reorderItemDown' 在此处定义。
String get reorderItemDown;
^^^^^^^^^^^^^^^
...
错误: 非抽象类'$en'缺少以下成员的实现:
i18n.dart:26
- WidgetsLocalizations.reorderItemDown
- WidgetsLocalizations.reorderItemLeft
- WidgetsLocalizations.reorderItemRight
- WidgetsLocalizations.reorderItemToEnd
- WidgetsLocalizations.reorderItemToStart
- WidgetsLocalizations.reorderItemUp
请尝试以下操作之一: - 提供一个实现,
- 继承自超类或混入类的实现,
- 将该类标记为抽象类,
- 提供'noSuchMethod'的实现。
class $en extends S {
^^^
...
错误: 字段'wLanguage'不能为可空或具有类型'Null',必须为'int'、'double'、'Pointer'或'Struct'或'Union'的子类型。
file_version_info.dart:13
external int? wLanguage;
^
错误: 字段'wCodePage'不能为可空或具有类型'Null',必须为'int'、'double'、'Pointer'或'Struct'或'Union'的子类型。
file_version_info.dart:16
external int? wCodePage;
^
目标kernel_snapshot失败: 异常
2
构建失败: 2个失败。
1: 任务失败,出现异常。
-
位置:
脚本'C:\flutter\packages\flutter_tools\gradle\flutter.gradle'的第1159行 -
出现了什么问题:
执行任务':app:compileFlutterBuildDebug'时出现异常。
> 进程'命令'C:\flutter\bin\flutter.bat''以非零退出值1完成 -
尝试:
> 使用--stacktrace选项运行以获取堆栈跟踪。
> 使用--info或--debug选项运行以获取更多日志输出。
> 使用--scan运行以获取完整的洞察信息。
==============================================================================
2: 任务失败,出现异常。
-
出现了什么问题:
java.lang.StackOverflowError(没有错误消息) -
尝试:
> 使用--stacktrace选项运行以获取堆栈跟踪。
> 使用--info或--debug选项运行以获取更多日志输出。
> 使用--scan运行以获取完整的洞察信息。
============================================================================== -
在https://help.gradle.org获取更多帮助
在1分钟5秒内构建失败
异常: Gradle任务assembleDebug以退出码1失败
已退出(sigterm)
有专家可以帮助我解决这些问题吗?我已经整天都在努力,但找不到解决方案。谢谢。
英文:
Error: The non-abstract class 'S' is missing implementations for these members:
i18n.dart:11
- WidgetsLocalizations.reorderItemDown
- WidgetsLocalizations.reorderItemLeft
- WidgetsLocalizations.reorderItemRight
- WidgetsLocalizations.reorderItemToEnd
- WidgetsLocalizations.reorderItemToStart
- WidgetsLocalizations.reorderItemUp
Try to either - provide an implementation,
- inherit an implementation from a superclass or mixin,
- mark the class as abstract, or
- provide a 'noSuchMethod' implementation.
class S implements WidgetsLocalizations {
^
/C:/flutter/packages/flutter/lib/src/widgets/localizations.dart:173:14: Context: 'WidgetsLocalizations.reorderItemDown' is defined here.
String get reorderItemDown;
^^^^^^^^^^^^^^^
/C:/flutter/packages/flutter/lib/src/widgets/localizations.dart:177:14: Context: 'WidgetsLocalizations.reorderItemLeft' is defined here.
String get reorderItemLeft;
^^^^^^^^^^^^^^^
/C:/flutter/packages/flutter/lib/src/widgets/localizations.dart:181:14: Context: 'WidgetsLocalizations.reorderItemRight' is defined here.
String get reorderItemRight;
^^^^^^^^^^^^^^^^
/C:/flutter/packages/flutter/lib/src/widgets/localizations.dart:165:14: Context: 'WidgetsLocalizations.reorderItemToEnd' is defined here.
String get reorderItemToEnd;
^^^^^^^^^^^^^^^^
/C:/flutter/packages/flutter/lib/src/widgets/localizations.dart:161:14: Context: 'WidgetsLocalizations.reorderItemToStart' is defined here.
String get reorderItemToStart;
^^^^^^^^^^^^^^^^^^
/C:/flutter/packages/flutter/lib/src/widgets/localizations.dart:169:14: Context: 'WidgetsLocalizations.reorderItemUp' is defined here.
String get reorderItemUp;
^^^^^^^^^^^^^
: Error: The non-abstract class '$en' is missing implementations for these members:
i18n.dart:26
- WidgetsLocalizations.reorderItemDown
- WidgetsLocalizations.reorderItemLeft
- WidgetsLocalizations.reorderItemRight
- WidgetsLocalizations.reorderItemToEnd
- WidgetsLocalizations.reorderItemToStart
- WidgetsLocalizations.reorderItemUp
Try to either - provide an implementation,
- inherit an implementation from a superclass or mixin,
- mark the class as abstract, or
- provide a 'noSuchMethod' implementation.
class $en extends S {
^^^
/C:/flutter/packages/flutter/lib/src/widgets/localizations.dart:173:14: Context: 'WidgetsLocalizations.reorderItemDown' is defined here.
String get reorderItemDown;
^^^^^^^^^^^^^^^
/C:/flutter/packages/flutter/lib/src/widgets/localizations.dart:177:14: Context: 'WidgetsLocalizations.reorderItemLeft' is defined here.
String get reorderItemLeft;
^^^^^^^^^^^^^^^
/C:/flutter/packages/flutter/lib/src/widgets/localizations.dart:181:14: Context: 'WidgetsLocalizations.reorderItemRight' is defined here.
String get reorderItemRight;
^^^^^^^^^^^^^^^^
/C:/flutter/packages/flutter/lib/src/widgets/localizations.dart:165:14: Context: 'WidgetsLocalizations.reorderItemToEnd' is defined here.
String get reorderItemToEnd;
^^^^^^^^^^^^^^^^
/C:/flutter/packages/flutter/lib/src/widgets/localizations.dart:161:14: Context: 'WidgetsLocalizations.reorderItemToStart' is defined here.
String get reorderItemToStart;
^^^^^^^^^^^^^^^^^^
/C:/flutter/packages/flutter/lib/src/widgets/localizations.dart:169:14: Context: 'WidgetsLocalizations.reorderItemUp' is defined here.
String get reorderItemUp;
^^^^^^^^^^^^^
: Error: Field 'wLanguage' cannot be nullable or have type 'Null', it must be int
, double
, Pointer
, or a subtype of Struct
or Union
.
file_version_info.dart:13
external int? wLanguage;
^
: Error: Field 'wCodePage' cannot be nullable or have type 'Null', it must be int
, double
, Pointer
, or a subtype of Struct
or Union
.
file_version_info.dart:16
external int? wCodePage;
^
Target kernel_snapshot failed: Exception
2
FAILURE: Build completed with 2 failures.
1: Task failed with an exception.
-
Where:
Script 'C:\flutter\packages\flutter_tools\gradle\flutter.gradle' line: 1159 -
What went wrong:
Execution failed for task ':app:compileFlutterBuildDebug'.
> Process 'command 'C:\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.
==============================================================================
2: Task failed with an exception.
-
What went wrong:
java.lang.StackOverflowError (no error message) -
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 1m 5s
Exception: Gradle task assembleDebug failed with exit code 1
Exited (sigterm)
Can someone expert to help me to solve these issues, I has been working for these whole day but can't find any solution. Thank you.
I can't find any solution
答案1
得分: 1
"simply adding overrides to i18n.dart solved my problem." can be translated to:
"只需在 i18n.dart 中添加覆盖即可解决我的问题。"
英文:
simply adding overrides to i18n.dart solved my problem.
import 'dart:async';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
// ignore_for_file: non_constant_identifier_names
// ignore_for_file: camel_case_types
// ignore_for_file: prefer_single_quotes
//This file is automatically generated. DO NOT EDIT, all your changes would be lost.
class S implements WidgetsLocalizations {
const S();
static const GeneratedLocalizationsDelegate delegate =
GeneratedLocalizationsDelegate();
static S? of(BuildContext context) =>
Localizations.of<S>(context, WidgetsLocalizations);
@override
TextDirection get textDirection => TextDirection.ltr;
@override
String get reorderItemDown => "To Down";
@override
String get reorderItemLeft => "To Left";
@override
String get reorderItemRight => "To Right";
@override
String get reorderItemToEnd => "To End";
@override
String get reorderItemToStart => "To Start";
@override
String get reorderItemUp => "To Up";
}
class en extends S {
const en();
}
class GeneratedLocalizationsDelegate extends LocalizationsDelegate<WidgetsLocalizations> {
const GeneratedLocalizationsDelegate();
List<Locale> get supportedLocales {
return const <Locale>[
Locale("en", ""),
];
}
LocaleResolutionCallback? resolution({Locale? fallback}) {
return (Locale? locale, Iterable<Locale> supported) {
final Locale languageLocale = Locale(locale!.languageCode, "");
if (supported.contains(locale)) {
return locale;
} else if (supported.contains(languageLocale)) {
return languageLocale;
} else {
final Locale fallbackLocale = fallback ?? supported.first;
return fallbackLocale;
}
};
}
@override
Future<WidgetsLocalizations> load(Locale locale) {
final String lang = getLang(locale);
switch (lang) {
case "en":
return SynchronousFuture<WidgetsLocalizations>(const en());
default:
return SynchronousFuture<WidgetsLocalizations>(const S());
}
}
@override
bool isSupported(Locale locale) => supportedLocales.contains(locale);
@override
bool shouldReload(GeneratedLocalizationsDelegate old) => false;
}
String getLang(Locale l) => l.countryCode != null && l.countryCode!.isEmpty
? l.languageCode
: l.toString();
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论