This file contains hidden or 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
import 'package:flutter/material.dart'; | |
void main() { | |
runApp(const MyApp()); | |
} | |
class MyApp extends StatelessWidget { | |
const MyApp({super.key}); | |
@override |
This file contains hidden or 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
import 'package:async/async.dart'; | |
/// Example of how AsyncCache can prevent concurrent execution. | |
void main() async { | |
// Call _execute every second. | |
// In a real use case, multiple triggers can call [_execute] | |
// e.g: start up, user interaction, connectivity change, etc | |
for (int i = 0; i < 10; i++) { | |
_execute(i); | |
await Future.delayed(Duration(seconds: 1)); |
OlderNewer