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
nodecalls a member of async_job or solo named one ofnameson the contextctx. -
cleanupContext(
Expression node) → Element? -
The context
nodeis registered as cleanup on, if it is one. -
controllerAround(
AstNode node) → DartType? -
The type of the class or the mixin around
node: the controller, whennodeis in one. -
declaresLane(
MethodInvocation call) → bool -
Whether
calldeclares a lane whereSoloLaneslets a controller declare it:lane(...)ofSoloLanesonthisorsuper, 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
argumentstands for: a literal, the declaration of the local function it names or the literal a final local variable it names holds;nullfor anything else. -
isDartCoreClass(
Element? element, String name) → bool -
Whether
elementis the classnamedeclared indart:core. -
isFromJobPackages(
Element? element) → bool -
Whether
elementcomes from a library of async_job or solo. -
isJobContext(
DartType? type) → bool -
Whether
typeisJobContextof async_job or one of its subtypes. -
isSolo(
DartType? type) → bool -
Whether
typeisSoloof solo or one of its subclasses. -
isSoloContext(
DartType? type) → bool -
Whether
typeisSoloContextof solo or one of its subtypes. -
isSoloController(
DartType? type) → bool -
Whether
typeisSoloControllerof solo, the base ofSoloandSoloLanes, or one of its subtypes. -
isSoloLane(
DartType? type) → bool -
Whether
typeisSoloLaneof solo, a lane ofSoloLanes, or one of its subtypes. -
isSoloLanes(
DartType? type) → bool -
Whether
typeisSoloLanesof solo, the controller with lanes, or one of its subtypes; a mixin onSoloLanesis one too. -
isSoloMember(
Element? element, String type, String name) → bool -
Whether
elementis the membernameof the class or enumtypedeclared in solo. -
jobContextOf(
FunctionExpression node) → FormalParameterElement? -
The context of
nodewhen it is a job body: its first parameter, if that is typedJobContextor a subtype. -
namedValue(
ArgumentList list, String name) → Expression? -
The value of the argument
nameoflist, if it is given. -
ownQueueCall(
Expression waited) → MethodInvocation? -
The call of the enclosing controller's own queue that
waitedwaits for:method(...).valueandmethod(...).donefor a method of aSolothat returns aSoloJob, andclose()andcancelAll()of aSolo. -
queueCallOf(
Expression waited) → MethodInvocation? -
The call
waitedwaits for: the target of.valueor.donewhen it is a call, orwaiteditself when it callscloseorcancelAll. -
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 whoseenqueuetakes the body. -
queueLaneOf(
Expression waited) → QueueLane -
Whose queue
waitedwaits for, when a job body of the enclosing controller waits for it. -
readsState(
AstNode node, Element ctx) → bool -
Whether
nodereadsctx.stateof aSoloContext. -
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
bodyreturns: 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
nodeis, otherwisenull.