Skip to content

difference between ..join vs .join and ..where vs .where ? #1274

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

You must be logged in to vote

The .. operator in Dart is called the cascade notation. Basically, it allows invoking a method while evaluating to the value the method was called on. For instance myList..clear() evaluates to myList while also calling its void clear() method.

Through a bit of an unfortunate design choice, you should use .. for every method on a select statement except for join(). Methods like where, orderBy and limit all return void, so the cascading notation is a perfect tool to add those clauses to a query without using a temporary variable.
By design, join does not return void but a JoinedSelectStatement. If you used ..join(), you'd still get the original select statement without the join as that's ho…

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@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