Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Isolate.resolvePackageUri does throw on iOS #172

Open
mathisfouques opened this issue May 6, 2023 · 0 comments
Open

Isolate.resolvePackageUri does throw on iOS #172

mathisfouques opened this issue May 6, 2023 · 0 comments

Comments

@mathisfouques
Copy link

mathisfouques commented May 6, 2023

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant