当前位置:网站首页>Dart extended feature
Dart extended feature
2022-06-30 14:00:00 【xiangxiongfly915】
List of articles
Dart Extended features
summary
Generally, a class should be extended , You need to inherit this class , stay dart 2.7 in the future , introduce extension, Used to extend the methods of the class .
Use
extension StringToNumber on String {
int toInt() {
return int.parse(this);
}
}
extension NumberOperator on int {
int add(int other) {
return this + other;
}
}
int result = "18".toInt();
int sum = 1.add(2);
API Conflict
Mode one
Use show or hide Restricted use .
import 'extension1.dart' hide StringToNumber, NumberOperator;
import 'extension2.dart';
Mode two
rename .
import 'extention1.dart';
import 'extention2.dart' as ext2;
边栏推荐
- Development of unity script program
- Directory related commands
- [recruitment (Guangzhou)] Chenggong Yi (Guangzhou) Net core middle and Senior Development Engineer
- DeFi“钱从哪来”?一个大多数人都没搞清楚的问题
- 数据库表为什么写不进数据了
- Waving flags and shouting for basic language
- Mqtt ROS simulates publishing a custom message type
- numpy 创建空数组 data = np.empty(shape=[1, 64,64,3])
- 【科研数据处理】[基础]类别变量频数分析图表、数值变量分布图表与正态性检验(包含对数正态)
- MySQL如何将列合并?
猜你喜欢

Unity animator parameter

Rpm2rpm packaging steps

【刷题篇】供暖器

Embedded development: five C features that may no longer be prohibited

【观察】智能产业加速,为何AI算力要先行?

MySQL access denied, opened as Administrator

WTM major updates, multi tenancy and single sign on

Observable, seulement fiable: première bombe de salon de la série cloudops d'exploitation et d'entretien automatisés dans le nuage

Flat shading with unity

深入理解.Net中的线程同步之构造模式(二)内核模式4.内核模式构造物的总结
随机推荐
Click the TD cell of table to open the dialog pop-up window. After obtaining the value, put the value back into the TD cell
Today's sleep quality record 80 points
一条查询SQL是如何执行的
【刷题篇】爱吃香蕉的珂珂
编程实战赛来啦!B站周边、高级会员等好礼送你啦!
我想问一下招商证券怎么开户?通过链接办理股票开户安全吗
数据库表为什么写不进数据了
There is no utf8 option for creating tables in Navicat database.
How to execute a query SQL
【Kubernetes系列】K8s设置MySQL8大小写不敏感
[KALI] KALI系统、软件更新(附带镜像源)
Assertions of regular series
In line with the trend of media integration, Zhongke Wenge and Meishe jointly create digital intelligence media publicity
How to take the first step in digital transformation
数字时代,XDR(扩展检测与响应)的无限可能
get请求与post提交区别的简易理解
优思学院:六西格玛不只是统计!
WTM major updates, multi tenancy and single sign on
Mqtt ROS simulates publishing a custom message type
Rk356x u-boot Institute (command section) 3.3 env related command usage