synchronized library

This simulates the synchronized feature of Java in an async way

Create a shared Lock object and use it using the Lock.synchronized method to prevent concurrent access to a shared resource.

class MyClass {
 final _lock = new Lock();
 Future<void> myMethod() async {
   await _lock.synchronized(() async {
     step1();
     step2();
     step3();
   });
 }

Classes

Lock
Object providing the implicit lock.