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.

Functions

cleanupContext(Expression node) → Element?
The context node is registered as cleanup on, if it is one.
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.
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 that returns a SoloJob, and close() and cancelAll().
registerAsyncJobLints(PluginRegistry registry, {bool ownQueueReportedElsewhere = 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.