Skip to content

Instantly share code, notes, and snippets.

@itang
Created June 27, 2013 06:10
Show Gist options
  • Save itang/5874318 to your computer and use it in GitHub Desktop.
Save itang/5874318 to your computer and use it in GitHub Desktop.
dart short style method
void main() {
print(f0()); // -> sss
print(f1()); // -> null
print(f2()); // -> sss
print(f3()); // -> yyy
var len = "dasada".split("").where((c) => c == 'a').length;
print("LEN:$len"); //-> 3
}
String f0(){ return "sss"; }
String f1(){ "sss"; }
String f2() => "sss";
String f3() => false? "sss" : "yyy";
//String f4() =>{return "sss"}; //syntax error
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment