Last active
May 4, 2022 12:46
-
-
Save marcel-ploch/dbfc595ad64d2693d605c38a7ed367d9 to your computer and use it in GitHub Desktop.
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
// Erweitere die Klasse string um die NumberParsing Extension | |
extension StringParsing on String { | |
String changeDirection() { | |
return this.split('').reversed.join(); | |
} | |
// ··· | |
} | |
class Person { | |
String name = ''; | |
Person({required this.name}) {} | |
String get reverseName { | |
return name.changeDirection(); | |
} | |
} | |
void main() async { | |
Future<String> waitForReverse(Person person) { | |
return Future.delayed(Duration(seconds: 2), () { | |
return person.reverseName; | |
}); | |
} | |
var name = Person(name: "Marcel"); | |
print(new DateTime.now().toString()); | |
var val = await waitForReverse(name); | |
print('$val'); | |
print(new DateTime.now().toString()); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment