plugin_api library

The API for an analyzer plugin built on top of async_job_lints.

A plugin that wants the rules of async_job_lints under its own name calls registerAsyncJobLints from its register, and may reuse the recognizers exported here for rules of its own. This library is not meant for the code a plugin checks. It follows semver with the package.

Enums

QueueLane
Whose queue a wait is for, as queueLaneOf tells it.

Functions

callsOn(MethodInvocation node, Element ctx, Set<String> names) → bool
Whether node calls a member of async_job or solo named one of names on the context ctx.
cleanupContext(Expression node) → Element?
The context node is registered as cleanup on, if it is one.
controllerAround(AstNode node) → DartType?
The type of the class or the mixin around node: the controller, when node is in one.
declaresLane(MethodInvocation call) → bool
Whether call declares a lane where SoloLanes lets a controller declare it: lane(...) of SoloLanes on this or super, right in a constructor body rather than in a function declared there.
firstPositional(ArgumentList list) → Expression?
The value of the first positional argument of list, if there is one.
functionOf(Expression argument) → FunctionExpression?
The function argument stands for: a literal, the declaration of the local function it names or the literal a final local variable it names holds; null for anything else.
isDartCoreClass(Element? element, String name) → bool
Whether element is the class name declared in dart:core.
isFromJobPackages(Element? element) → bool
Whether element comes from a library of async_job or solo.
isJobContext(DartType? type) → bool
Whether type is JobContext of async_job or one of its subtypes.
isSolo(DartType? type) → bool
Whether type is Solo of solo or one of its subclasses.
isSoloContext(DartType? type) → bool
Whether type is SoloContext of solo or one of its subtypes.
isSoloController(DartType? type) → bool
Whether type is SoloController of solo, the base of Solo and SoloLanes, or one of its subtypes.
isSoloLane(DartType? type) → bool
Whether type is SoloLane of solo, a lane of SoloLanes, or one of its subtypes.
isSoloLanes(DartType? type) → bool
Whether type is SoloLanes of solo, the controller with lanes, or one of its subtypes; a mixin on SoloLanes is one too.
isSoloMember(Element? element, String type, String name) → bool
Whether element is the member name of the class or enum type declared in solo.
jobContextOf(FunctionExpression node) → FormalParameterElement?
The context of node when it is a job body: its first parameter, if that is typed JobContext or a subtype.
namedValue(ArgumentList list, String name) → Expression?
The value of the argument name of list, if it is given.
ownQueueCall(Expression waited) → MethodInvocation?
The call of the enclosing controller's own queue that waited waits for: method(...).value and method(...).done for a method of a Solo that returns a SoloJob, and close() and cancelAll() of a Solo.
queueCallOf(Expression waited) → MethodInvocation?
The call waited waits for: the target of .value or .done when it is a call, or waited itself when it calls close or cancelAll.
queuedBodyOf(AstNode node) → ({Element ctx, Element? lane})?
The job body of this controller that waits for node, when there is one: its context, and the lane field whose enqueue takes the body.
queueLaneOf(Expression waited) → QueueLane
Whose queue waited waits for, when a job body of the enclosing controller waits for it.
readsState(AstNode node, Element ctx) → bool
Whether node reads ctx.state of a SoloContext.
registerAsyncJobLints(PluginRegistry registry, {bool ownQueueReportedElsewhere = false, bool ownLaneReportedElsewhere = false}) → void
Registers the rules of async_job_lints and their quick fixes in registry.
returnedValues(FunctionBody body) → List<Expression>
The values body returns: its expression, or the values of the return statements of its block outside the functions declared in it.
waitingContext(FunctionExpression node) → Element?
The context of the waiting call whose action node is, otherwise null.