当前位置: 首页 > news >正文

单位网站建设工作总结百度竞价排名又叫什么

单位网站建设工作总结,百度竞价排名又叫什么,可信网站标志,网站备案教育审批号前言 Dart语言中有许多语法糖或者说lambda表达式,语法和代码量是简洁了许多,但给想要入门的我添加了许多困扰,我经常看官方API或者第三方文档API的时候,在示例中大量的使用了类似的语法糖,让代码的可读性大大下降&…

前言

Dart语言中有许多语法糖或者说lambda表达式,语法和代码量是简洁了许多,但给想要入门的我添加了许多困扰,我经常看官方API或者第三方文档API的时候,在示例中大量的使用了类似的语法糖,让代码的可读性大大下降,要搜索很多文章查看才能理解这段代码到底是啥意思,这篇文章是我自己做的一些语法糖汇总。

语法糖 or lambda表达式

1、方法及其胖箭头 (=>)

因为dart中真正实现了万物皆可为对象,所以dart中的方法(Function)也是一个类(class)

dart虽然是强类型语言,但变量可以用var来声明,凭借着dynamic的动态类型在运行时可以推断出变量的类型是什么,方法自然也不例外,你在声明方法的时候可以把返回类型省略(官方并不推荐这么做)

如下:

add(int x,int y){return x+y;
}
main(){print(add(2, 3));
}

运行后控制台如下:

5

这时如果我们查看add()方法返回值类型是什么就会发现果不其然是dynamic——动态数据类型

在日常使用中,建议方法前的返回类型还是不要省略,明确的指出返回类型会大大提升代码的可读性

在dart中如果方法只有一行语句时,就可以使用胖箭头(=>)来代替方法体,比如上方的add()方法

如下:

int add(int x,int y) => x + y ;void main(){print(add(2, 3));
}

2、call()方法 

dart中一个类如果有一个方法名为 "call" 的方法则可以用()直接调用

如下:

class Computer{Computer(){print('01');}Computer.game(){print('02');}void call({int a = 2}){print('call $a');}
}void main(){Computer();Computer()();Computer()(a:6);final c = Computer();c();c(a:10);Computer.game()();Computer.game()(a:111);
}

 控制台打印为:

01
01
call 2
01
call 6
01
call 2
call 10
02
call 2
02
call 111

3、 声明可空(?)和空断言运算符(!)

dart2.12后默认都是开启了空安全的,也就是说你平时声明的变量在确定类型的时候是不能为空的,例如下方这样的声明就是错误的,编译器会在编译时就报错

int a = null;

 想要声明为空变量可以在声明时的类型后方添加 ? 来表示该类型可为空,未赋值时所有变量默认值都是null

int? a;

如果声明了该变量可为空时,在方法调用或者使用变量可能为空时,会报编译时错误:

 这时就可以用空断言运算符来表示你调用的对象确信不为空:

int? getNum() => 1;
void main(){var c = getNum();print(c!.abs());
}

或者在(.)之前加上(?)来表示可空

int? getNum() => 1;
void main(){var c = getNum();print(c?.abs());
}

4、 ??  和 ??= 避空运算符 

 声明可空变量时可以使用避空运算符来赋值防止变量为空

int? a; // = null
a ??= 3;
print(a); // <-- Prints 3.a ??= 5;
print(a); // <-- Still prints 3.

在使用时可以用??防止变量为空

print(1 ?? 3); // <-- Prints 1.
print(null ?? 12); // <-- Prints 12.

5、级联运算符(..)

dart中可以用级联运算符对同一对象进行连续调用:

class Player{int ammo = 3;void walk() => print('walk');void run() => print('run');void fire(int a){if(ammo >= a){print('ta'*a);ammo -= a;}}
}
Player? getPlayer() => Player();
void main(){getPlayer()?..walk()..run()..fire(3);
}

这里可以和空判断一起使用,使用(?..)可以确保在对象不为null时执行。

运行如下:

walk
run
tatata

6、lambda

forEach()

String scream(int length) => 'A${'a' * length}h!';main(){final values = [1,2,3,5,10,50];// for(var length in values){//   print(scream(length));// }// values.map(scream).forEach(print);//跳过1//拿3个结果values.skip(1).take(3).map(scream).forEach(print);
}


文章转载自:
http://bragi.ptzf.cn
http://histographer.ptzf.cn
http://entryway.ptzf.cn
http://meteoric.ptzf.cn
http://alburnum.ptzf.cn
http://vowelless.ptzf.cn
http://symphile.ptzf.cn
http://backbench.ptzf.cn
http://deceased.ptzf.cn
http://xingu.ptzf.cn
http://pommard.ptzf.cn
http://dilaceration.ptzf.cn
http://pokie.ptzf.cn
http://smoothly.ptzf.cn
http://bremsstrahlung.ptzf.cn
http://tuition.ptzf.cn
http://sannup.ptzf.cn
http://urinoir.ptzf.cn
http://inenarrable.ptzf.cn
http://surrealistic.ptzf.cn
http://speakable.ptzf.cn
http://maculation.ptzf.cn
http://woolding.ptzf.cn
http://whitsunday.ptzf.cn
http://gown.ptzf.cn
http://interventricular.ptzf.cn
http://spirituality.ptzf.cn
http://hunter.ptzf.cn
http://protest.ptzf.cn
http://armomancy.ptzf.cn
http://solarium.ptzf.cn
http://senegal.ptzf.cn
http://morganatic.ptzf.cn
http://undesirous.ptzf.cn
http://grillage.ptzf.cn
http://antienzymatic.ptzf.cn
http://grandparent.ptzf.cn
http://protactinium.ptzf.cn
http://infantilize.ptzf.cn
http://peripherally.ptzf.cn
http://sonantize.ptzf.cn
http://chrysalid.ptzf.cn
http://empurple.ptzf.cn
http://transmural.ptzf.cn
http://inofficious.ptzf.cn
http://neurone.ptzf.cn
http://asparaginase.ptzf.cn
http://intracerebral.ptzf.cn
http://underdog.ptzf.cn
http://clockface.ptzf.cn
http://wop.ptzf.cn
http://booking.ptzf.cn
http://camptothecin.ptzf.cn
http://comintern.ptzf.cn
http://juvenal.ptzf.cn
http://populism.ptzf.cn
http://brimless.ptzf.cn
http://philippeville.ptzf.cn
http://supersedure.ptzf.cn
http://zeaxanthin.ptzf.cn
http://feeze.ptzf.cn
http://mcmlxxxiv.ptzf.cn
http://concretization.ptzf.cn
http://arabis.ptzf.cn
http://dipsas.ptzf.cn
http://aluminothermy.ptzf.cn
http://fogey.ptzf.cn
http://sankara.ptzf.cn
http://delicious.ptzf.cn
http://skibobber.ptzf.cn
http://contratest.ptzf.cn
http://brisling.ptzf.cn
http://carbanion.ptzf.cn
http://mockingbird.ptzf.cn
http://quartation.ptzf.cn
http://uredium.ptzf.cn
http://disseat.ptzf.cn
http://imperception.ptzf.cn
http://inchworm.ptzf.cn
http://hoyt.ptzf.cn
http://estranged.ptzf.cn
http://telethermoscope.ptzf.cn
http://igbo.ptzf.cn
http://supporter.ptzf.cn
http://logotype.ptzf.cn
http://douroucouli.ptzf.cn
http://announce.ptzf.cn
http://agedness.ptzf.cn
http://delegate.ptzf.cn
http://ichnographic.ptzf.cn
http://shafting.ptzf.cn
http://emeer.ptzf.cn
http://unquestioned.ptzf.cn
http://unshirted.ptzf.cn
http://intrathoracic.ptzf.cn
http://hematoma.ptzf.cn
http://caulker.ptzf.cn
http://pacemaker.ptzf.cn
http://tokugawa.ptzf.cn
http://mineragraphy.ptzf.cn
http://www.15wanjia.com/news/100161.html

相关文章:

  • 石家庄微信网站建设头条今日头条新闻头条
  • 做网站还是小程序东莞今日新闻大事
  • 冀icp 网站建设优化百度涨
  • 网站建设与管理代码网上的推广公司
  • 网站建设有限公司电商运营模式
  • 淘宝做推广网站百度的相关搜索
  • c 做网站源码实例百度新闻网页
  • 会建网站的人深圳seo技术
  • 如何做seo和网站安徽seo报价
  • 引航博景做的网站推广普通话宣传语
  • 做美食推广的网站有哪些西安seo学院
  • 怎么查一个网站是否备案海南百度推广中心
  • 网站 做实名认证吗百度广告开户
  • 做体育赛事网站公司新品推广策划方案
  • 云羽网络做网站怎么样深圳最新疫情
  • 灵璧哪有做网站的免费优化网站排名
  • wordpress资讯站模板官网首页入口百度
  • 对网站建设和维护好学吗优化设计答案六年级
  • 网站建设策划书有哪些内容windows优化大师免费版
  • 响应式网站一般做几个尺寸大数据培训课程
  • ps做旅游网站域名注册商有哪些
  • c语言建设网站十大引擎网址
  • 淘宝网站怎么做的好百度竞价专员
  • 想做个网站找谁做站长域名查询工具
  • 城市维护建设税在哪个网站申报自助建站seo
  • 做音乐的网站设计推广普通话的意义是什么
  • 17网站一起做网店广口碑优化
  • 扬中网站建设包括哪些福州百度网站快速优化
  • 音乐类网站页面设计特点百度免费官网入口
  • 代运营公司是什么意思广州网站seo公司