当前位置:网站首页>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;
边栏推荐
- How can I protect my private key?
- Directory related commands
- With the development of industrial Internet, the landing and application of the Internet has become wider
- [the path of system analyst] Chapter 5 Software Engineering (Agile Development)
- Basic syntax of unity script (5) - vector
- 可观测,才可靠:云上自动化运维CloudOps系列沙龙 第一弹
- 我想问一下招商证券怎么开户?通过链接办理股票开户安全吗
- Deep understanding Net (2) kernel mode 3 Kernel mode construct mutex
- SQL考勤统计月报表
- 想請教一下,我在佛山,到哪裏開戶比較好?手機開戶是安全麼?
猜你喜欢

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

深入理解.Net中的线程同步之构造模式(二)内核模式4.内核模式构造物的总结

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

Loss function: Diou loss handwriting implementation

60 divine vs Code plug-ins!!

Unity Animator 参数

A keepalived high availability accident made me learn it again!

This editor will open source soon!

步骤详解 | 助您轻松提交 Google Play 数据安全表单

Pytorch查看模型参数量和计算量
随机推荐
华为帐号多端协同,打造美好互联生活
发生QQ大规模盗号事件,暴露出什么网络安全问题?
【招聘(广州)】成功易(广州).Net Core中高级开发工程师
60 个神级 VS Code 插件!!
What is erdma as illustrated by Coptic cartoon?
There is no utf8 option for creating tables in Navicat database.
Knowledge dissemination cannot replace professional learning!
DeFi“钱从哪来”?一个大多数人都没搞清楚的问题
Write, append, read, and copy of golang files: examples of using bufio packages
I want to ask how to open an account at China Merchants Securities? Is it safe to open a stock account through the link
Basic syntax of unity script (4) - access to other game objects
visualstudio 和sql
golang模板(text/template)
Flat shading with unity
On the simplification and acceleration of join operation
Publicity of the fourth batch of shortlisted Enterprises - annual Top100 smart Internet supplier selection
2022-06-23 sail soft part formula and SQL generation (month and quarter retrieval)
半导体动态杂谈
Embedded development: five C features that may no longer be prohibited
Development of unity script program