flutter3d_lints 1.0.0-rc.2
flutter3d_lints: ^1.0.0-rc.2 copied to clipboard
Outside the 1.0 semver promise. Analyzer rules for a flutter3d fixed step: no wall clock, no unseeded Random, no dart:math transcendental where Portable gives one answer.
1.0.0-rc.2 #
Since the 2026-10-14 upload, two import rules and one JSON
document. avoid_engine_internal_imports and hide_flutter_matrix4
are new, the subscription migration kind rewrites a handler slot into a
call that answers a Registration, and migrate --json prints one
document in the f3d.cli envelope. That last one breaks a script that
read a JSON object a line. The entry below says why this package stays
outside the 1.0 promise.
-
migratereaches what the apps of 1.0.0-rc.1 left behind. A class a record became is added to theshowof the import that brings its library, where a creation or a rewrite writes it (ButtonPair,ClearColor); a required named parameter added with the value old calls get is passed in a call of a named constructor, whichdart fixdoes not reach (NativeLiquidHeat.water()); a call of a function still there whose answer changed gets its TODO, and so does each read of the local holding such an answer that the new type does not fit; a handler that may be null keeps its assignment and a TODO rather than being subscribed; a closure that names no type for its parameter is wrapped for the old callback's shape; and a destructuring pattern over a conditional, or a list typed by a record's shape, gets a TODO where one of its values is the class now. -
migratefollows a break onto the project's own subclass, and runs twice without writing twice. A slot gone from an engine class is subscribed on a project's subclass of it too (run.onChanged = emiton aPlatformerRunisrun.listen(emit)); a renamed extension member is matched on the type it extends, by the entry'son:; a rewrite into an extension of another library adds that import; a rewrite whose template calls the member it rewrites leaves a call that already fits it; seconds written as a number become a wholeDurationconstant, so aconstcreation stays one; a positional record where a class with named fields is expected becomes a creation of it, and a project's own record type meeting that class gets a TODO. -
The
subscriptionmigration kind. A slot that held one handler and became a method answering aRegistration:x.slot = handlerbecomesx.method(handler), and anullset or a read of the slot gets a TODO. -
Breaking:
migrate --jsonprints one document in thef3d.clienvelope.format,version1,commandandfiles, a report a file, where it printed a bare JSON object a line;flutter3d migratereads both, and refuses a newerversionwith a sentence.--helpprints the usage to stdout and exits 0, an option it does not take exits 2 where it was dropped and the run went on, and a project that is not there exits 1. Its command line is snapshotted inapi/flutter3d_lints.cliand held to the 1.0 promise, though the package's Dart API is not. -
Two import rules.
avoid_engine_internal_importswarns on an import of an engine package'sinternal.dart,builtin.dartorsrc/from a project's own code: those are outside semver and change in a minor.hide_flutter_matrix4warns where Flutter'sMatrix4and the engine's meet in one file with neither hidden, and its quick fix addshide Matrix4to the Flutter import.scanEngineImportsruns both over a unit for tooling of one's own. -
The engine's number, outside the 1.0 promise. Its signatures carry types of a package before 1.0 or of one that takes a major a year, so a release of that package may break this API in a minor, and the break is labelled here. SUPPORT.md names the four packages outside the promise; the number says which engine release this one goes with, and every pin the engine writes on it is the engine's own.
-
Breaking: the rule classes are the package's own.
StepReadsNoClock,StepTakesSeededRandom,StepUsesPortableMath,StepPrefixesDartMath,simulationRules()and the plugin classmain.dartregisters them with are no longer exported: they extend classes ofanalysis_server_plugin, which is at 0.x, and a 1.x library naming them would break with its next minor.flutter3d_lints.dartexportsscanSimulationCode,SimulationFinding,SimulationRulesandmachineArithmetic; the analyzer loadsmain.dart'spluginas before. -
A second pass changes nothing the first one wrote. A callback a rule wraps, or a value it turns into a
Duration, is left alone once it has the parameter's type; a hook's parameters rewritten whole win over a rename inside them, so the reads from the context are never written into a method that does not take it. A project named like one of the engine's packages (flame_flutter3d_example) has its own classes madebaseunder a base class; a renamed class whose old name another engine package took since (Unit) is renamed as onedart:coreshadows is; a record in a collectionfororif, or a map's value, becomes the class it was typed as. Arewritereaches a call of a field of a function type (tool.run(session, arguments)), and leaves a call with fewer arguments than its template reads, which is the new call already. -
A hook that took nothing is migrated too. A
hookContextentry with no fields gives an override its new parameter and hands a callconst <Context>(), which asks for nothing;AssetSource.readis the first. -
The TODO stands where the error does. A use further down a statement gets its TODO on the line above it; a gone function or class named as a value, each name of a gone library, each use of a name gone internal, each override of a type whose implementers have something to do, and each argument a changed call lost or now takes in another type, carry one.
--automaticwrites only what needs no person. -
More is carried out with the resolved code. A moved name is imported where a project reached it through its own re-export; a renamed member, a renamed named parameter, a class renamed under an import prefix, in a
showorhide, or from a name the Dart SDK also has (Match); an implementer's declaration of a renamed member and its uses; a record built where the class it became goes (a return, a closure, a variable, an argument, a list); a renamed field of a record typedef; a call that became asynchronous, awaited in anasyncbody (a test's callback, or a function that returns nothing, madeasyncfor it); a component read off aLinearColorthe engine hands out (.xis.r). -
A positional argument that became named is named for you.
migratewritessettings:before the second argument ofAdaptiveQuality(table, s), and the same for each constructor whose optional positional arguments 1.0 made named (AssetManifest,EnumHintValue,MaterialVariant,TraceDraw,ParticleGravity).dart fixoffers no fix for an extra positional argument, so this is where it happens. A call that passes the name as well keeps a TODO. -
More of the move to 1.0 is written for you. A colour passed as a
Vector3orVector4where 1.0 takes aLinearColorbecomes one, asLinearColor(r, g, b)orLinearColor.fromSrgb(r, g, b, a)by how that colour was encoded, in an argument and in an assignment; a parameter that was renamed or changed its unit is rewritten (arcDegrees: 100toarc: 100 * pi / 180); a static member that is gone is rewritten through its class (DesktopInput.defaultBindings()); and a class renamed in aconstcreation, whichdart fixcannot resolve, takes its new name. A value it cannot write once, and a read used as the old type, keep the TODO. -
Code written against 0.8 is told what 1.0 changed, at each use. Two more warnings come from the migration table:
flutter3d_migratehas a quick fix. It rewrites a deprecated capability getter on aGraphicsDeviceintofeatures.has(...)orlimits.…, and turnsimplements Xintowith Xon abaseclass, for the types 1.0 madebase mixin classes. It also moves named arguments that became an options object into it (View3d(fov: 1)toView3d(view: ViewOptions(fov: 1))), gives aswitchover a type that stopped being an enum or sealed a wildcard that throws, reads.$1of a record that became a class through its getter, and turns a null check right beside a call that throws now intotry … onthe exception. The last two of those leave a TODO beside what they wrote, because a person decides what the new case or the caught exception does.flutter3d_migrate_by_handlinks the guide's line for a change a person has to make. A name 1.0 keeps to its package is reported once per import of that package, listing every such name the file uses, rather than at each use.
Both use the resolved code, so a class of your own with a
supportsWireframeis left alone.dart fixdoes not apply a plugin's fixes in bulk, sodart run flutter3d_lints:migrate <project>applies all of them across a project, puts a TODO above each use left for a person, and hides on a flutter3d import a name 1.0 started exporting that the project declares itself.flutter3d_build:migrateruns it. -
A plugin's simulation code is held to the engine's rules. Four analyzer rules, shipped as an analysis server plugin and enabled by listing the package under
plugins:inanalysis_options.yaml:step_reads_no_clock,step_takes_seeded_random,step_uses_portable_mathandstep_prefixes_dart_math. They are the rulestool/structure.dartholds this repository's packages to, put in the editor of anybody writing a step, because a replay is the same run only while every step computes the same thing on every machine. -
Stronger than a text scan where a resolver can say more. A transcendental is reported by what it resolves to, so a call through any prefix of
dart:math, or through an unprefixed import, is found, and a class of the author's own namedRandomis not. A comment or a string that names a forbidden call is not reported. -
Warnings, so enabling the plugin enables them. Each can be turned off by name under
diagnostics:, or silenced for a file that runs once a frame rather than in the step with// ignore_for_file: flutter3d_lints/<rule>.