Skip to content

Book bridge example (not yet working) #161

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

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

BenVercammen
Copy link

@ethanblake4 Could you please have a look at this example? I've tried to reconstruct the Book bridge example from the README.md file, but get the following error:

dart_eval runtime exception: type 'List<$Value>' is not a subtype of type 'List<String>'

@ethanblake4
Copy link
Owner

ethanblake4 commented Jan 8, 2024

Was an error with the example, will be updated in next release.

You can change the $new function in the $Book$bridge class to the following to fix:

static $Value? $new(
  Runtime runtime, $Value? target, List<$Value?> args) {
  return $Book$bridge((args[0]!.$reified as List).cast());
}

@BenVercammen BenVercammen marked this pull request as draft January 13, 2024 10:04
@BenVercammen
Copy link
Author

@ethanblake4 A new question.. I'd like to modify the list in the program, but the new pages don't show up in the bridged class. I suppose that the problem lies in my $getProperty method, but I'm not sure where to get the actual value from... Could you shed some light on this please?

@ethanblake4
Copy link
Owner

That specific use case isn't really supported with the built-in $List class currently. I created an issue to track it. You could make a custom $List wrapper that supports writeback via a type-mapper function, but if you want to do this now I'd suggest just making an addPage function or similar.

@ethanblake4
Copy link
Owner

This is now supported in v0.7.5 using the new $List.view() constructor

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

Successfully merging this pull request may close these issues.

2 participants