Isolate.resolvePackageUri does throw on iOS
mathisfouques opened this issue · 0 comments
On iOS 16.0, the call to Isolate.resolvePackageUri throw a Unhandled Exception: Unsupported operation: Isolate.resolvePackageUri .
It is called in the lib/standalone.dart file, in the method initializeTimeZone, when it calls _loadAsBytes (which itself calls the Isolate.resolvePackageUri function).
I am able to solve it by using the latest.dart file instead of the call to resolvePackageUri that calls the .tz database file.
Here is my function that makes a call directly to lib/src/env.dart "initializeDatabase"
Future<void> _initializeTimeZone([String? path]) {
path ??= tzDataDefaultPath;
return Isolate.run(getTimezoneData)
.then(initializeDatabase)
.catchError((dynamic e) {
throw TimeZoneInitException(e.toString());
});
}
and uses this function from latest.dart that I added
Uint8List getTimezoneData() =>
Uint16List.fromList(_embeddedData.codeUnits).buffer.asUint8List();
I think by making a PR we could do something more maintainable, but before I need to know if there is any particular reason why we would call Isolate.resolvePackageUri, or if there is anything that would prevent from doing a PR on this topic ?
Thanks