PayHereLK / payhere-mobilesdk-flutter

PayHere Mobile SDK for Flutter
BSD 3-Clause "New" or "Revised" License
5 stars 16 forks source link

Proper use of dart:async library #8

Closed iwalpola closed 3 years ago

iwalpola commented 3 years ago

this is a breaking change. Projects will have to prepend each frontend call to startPayment() with "await" therefore this is only a suggestion for MAJOR version change (2.0.0)

The original /lib/payhere_mobilesdk_flutter.dart imports dart:async but does not use it.

This is because_channel.invokeMethod("startPayment", paymentObject).then(( ) { }) makes the method channel invocation synchronous.

this is why startPayment() can be called from /example/lib/main.dart without "await" keyword.

This actually is 100% correct way to do it, no rules are broken.

But async/await is more in line with dart convention.

iwalpola commented 3 years ago

canceled, decided to not alter existing repository, which may be live in production