Skip to content

example of using _createMoorIsolate #1257

Answered by simolus3
matthewkooshad asked this question in Q&A
Discussion options

You must be logged in to vote

DatabaseConnection.delayed is the way to go. It takes a future as an argument and returns a connection that is ready once the future completes.
So you should be able to just setup the database like this:

void main() {
  db = Database.connect(DatabaseConnection.delayed(_createMoorIsolate()));
  // ...
}

as i noticed _connectAsync from that doc returns a Future
but, _createMoorIsolate from that doc returns a Future

I don't see a contradiction here :D If you want to turn a Future<DatabaseConnection> into a DatabaseConnection, use DatabaseConnection.delayed.
If that doesn't work for you please let me know.

Replies: 1 comment 15 replies

Comment options

You must be logged in to vote
15 replies
@simolus3
Comment options

@matthewkooshad
Comment options

@matthewkooshad
Comment options

@simolus3
Comment options

@matthewkooshad
Comment options

Answer selected by matthewkooshad
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants