简体   繁体   English

飞镖、颤振中的 SET 和 GET

[英]SET and GET in dart, Flutter

Could you please explain what do set and get do in the code bellow?您能否解释一下在下面的代码中设置和获取的内容?

class AppScrollBehavior extends MaterialScrollBehavior {

  @override

  Set<PointerDeviceKind> get dragDevices => {

        PointerDeviceKind.touch,
        PointerDeviceKind.mouse,

      };
}

Set is one of the Data Types in Dart. Set是 Dart 中的数据类型之一。 A Set is the collection of objects in which each object can occur only once.集合是对象的集合,其中每个对象只能出现一次。

According to documentation:-根据文件:-

A collection of objects in which each object can occur only once.一个对象集合,其中每个对象只能出现一次。 That is, for each object of the element type, the object is either considered to be in the set, or to not be in the set.也就是说,对于元素类型的每个对象,该对象要么被认为在集合中,要么被认为不在集合中。 Set implementations may consider some elements indistinguishable.集合实现可能会认为某些元素无法区分。 These elements are treated as being the same for any operation on the set.对于集合上的任何操作,这些元素都被视为相同。 The default Set implementation, LinkedHashSet, considers objects indistinguishable if they are equal with regard to Object.== and Object.hashCode.默认的 Set 实现 LinkedHashSet 认为对象在 Object.== 和 Object.hashCode 方面相等时无法区分。

More about Set here更多关于设置在这里

and get Getters are special methods that provide read and to an object's properties.get Getter 是提供读取和对象属性的特殊方法。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM