Created
March 22, 2024 15:49
-
-
Save epatel/61f88601a41c7af9aa8e48140d83e54f to your computer and use it in GitHub Desktop.
Null after future
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 Test { | |
final String text; | |
Test({ | |
required this.text, | |
}); | |
Future<void> hello() async { | |
await Future.delayed(Duration(seconds: 2)); | |
print(text); | |
} | |
} | |
void main() { | |
Test? test = Test(text: 'Hello!!!'); | |
print('Start'); | |
test.hello(); | |
test = null; | |
print('End'); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment