$removeJoinBuilderFromRootComposer property

void Function(JoinBuilder) $removeJoinBuilderFromRootComposer
latefinalinherited

A function to remove a join builder from the root composer This is used to remove join builders that are no longer needed. e.g.

db.managers.todos.filter((f) => f.category.id(5))

When f.category is called, the join builder for the category table is created and added to f (the root composer). However, when .id(5) is called, we realize that we don't want to filter on category.id, but on todos.category. The filter is rewritten to filter on todos.category instead of category.id and the join builder is removed.

This function only removes a single join builder. This is because the join builder may have been used by other composers.

db.managers.todos.filter((f) => f.category.name('Math') & f.category.id(5))

In this case we don't want .id(5) to remove all the join builders, because it is still needed by the .name('Math') filter. Therefore, we remove a single join builder.

Don't worry, when we eventualy build the the query, the duplicate join builders will be removed.

Implementation

late final void Function(JoinBuilder) $removeJoinBuilderFromRootComposer;