flutter dart 中的“@”是什么意思?

ncgqoxb0  于 2023-05-19  发布在  Flutter
关注(0)|答案(1)|浏览(403)

终端中的@指的是什么?

class NumberTriviaLocalDataSourceImpl implements NumberTriviaLocalDataSource {
  final SharedPreferences sharedPreferences;  // use ? for solving the error 

  NumberTriviaLocalDataSourceImpl({@required this.sharedPreferences});
  // With null safety, use the 'required' keyword, not the '@required' annotation. Try removing the '@'.
8mmmxcuj

8mmmxcuj1#

在Dart和Flutter中,“@”符号是元数据的语法。当声明类、方法和变量时,元数据可以用来为Dart编译器提供额外的信息或指令。这里是dart文档https://dart.dev/language/metadata的链接

相关问题