This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void main() { | |
perform(); | |
} | |
void perform() { | |
task1(); | |
String data = task2(); | |
task3(data); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void main() { | |
perform(); | |
} | |
void perform() async { | |
task1(); | |
String data = await task2(); | |
task3(data); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Person { | |
final String name; | |
final int age; | |
Person(this.name, this.age); | |
void introduce(){ | |
print(name + ':' + age.toString()); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// メソッド名と引数の型だけを定義 | |
class Person { | |
Person({ required this.greeting, required this.cal }); | |
final Function(String) greeting; | |
final Function(int) cal; | |
} | |
void greet(String value){ | |
print(value + 'に挨拶!'); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// メソッド名と引数の型だけを定義 | |
class Person { | |
Person({ required this.greeting, required this.cal }); | |
final Function(String) greeting; | |
final Function(int) cal; | |
} | |
main() { | |
Person jojo = Person(greeting: (value) => print(value + 'に挨拶!'), | |
cal: (value) => print(value * value), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Person { | |
String? _name; | |
int? _age; | |
Person(String name, int age) { | |
_name = name; | |
_age = age; | |
} | |
void introduce() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Person { | |
String name; | |
int age; | |
Person(this.name, this.age); | |
void introduce() { | |
print(name + ':' + age.toString()); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Person { | |
String name; | |
int age; | |
Person(this.name, this.age); | |
void introduce(){ | |
print(name + ':' + age.toString()); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Person { | |
String? name; | |
int? age; | |
Person(this.name, this.age); | |
Person.duo(){ | |
name = 'duo'; | |
age = 100; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Person { | |
String name; | |
int age; | |
// {}をつけている | |
Person({required this.name, required this.age}); | |
} | |
void main(){ | |
// インスタンス化する時に、nameとageを指定している |
NewerOlder