pinkfish / flutter_native_timezone

Apache License 2.0
78 stars 156 forks source link

The usage example you provided is not working #11

Closed Errechydy closed 4 years ago

Errechydy commented 4 years ago

I'm getting this error when calling final String currentTimeZone = await FlutterNativeTimezone.getLocalTimezone();

Compiler message: Error: 'await' can only be used in 'async' or 'async*' methods. final String currentTimeZone = await FlutterNativeTimezone.getLocalTimezone()

royibernthal commented 4 years ago

I'm getting this error when calling final String currentTimeZone = await FlutterNativeTimezone.getLocalTimezone();

Compiler message: Error: 'await' can only be used in 'async' or 'async*' methods. final String currentTimeZone = await FlutterNativeTimezone.getLocalTimezone()

Make sure you're running it inside of a method marked as async. You're probably trying to run it in a sync method (that's the default). It's not related to the package, it's basic async/await functionality. Try googling dart async/await.

Errechydy commented 4 years ago

Thanks i already found that it needs to be inside an async method. you probably need to mention that in the example you provided