Repository navigation
Releases
Releases · anilcancakir/magic
1.0.1
Changed
- The pub.dev listing shows the Magic logo.
pubspec.yamlgains ascreenshotsentry that points at a 1024 pixel PNG render of the repository logo, aswind_kitdoes. (pubspec.yaml,screenshots/) - The pub.dev listing and the README now lead with the product pitch and keep Laravel as a secondary note. The description, topics, README,
llms.txtandCLAUDE.mdsay what core carries and which layers (realtime, payments, SQLite, notifications and more) are official plugins, and the Platforms row names the platforms explicitly. The installation page's introduction leads with the same pitch and moves Laravel to a "Familiar to Laravel Developers" note, and the directory-structure page's opening line names the folders first and mentions Laravel's conventions last. (pubspec.yaml,README.md,llms.txt,CLAUDE.md,doc/getting-started/) - The
magic-frameworkagent skill covers the core package only. Every official plugin ships its own skill now, so the twelvereferences/plugin-*.mdpages are gone and the skill keeps a short table of what each plugin is and which skill to load (npx skills add anilcancakir/<package>). The description and body follow the skill conventions (no counts, one-line triggers), the repository links nameanilcancakir/magic, andreferences/plugins.mdcarries the install steps and provider-order rules that are common to every plugin. (skills/magic-framework/) - Every link from the README and
doc/to an ecosystem plugin names the new location. A plugin's package page ishttps://anilcancakir.com/magic/<slug>and its documentation sits underhttps://anilcancakir.com/magic/docs/<slug>; the core URLs do not change. (README.md,doc/) - Doc tables are left-aligned and the prose uses British spelling. Every table separator is left-aligned (
:---or a longer:----form), and prose reads "behaviour", "colour", "initialise", "authorisation" and so on; code, API names and page titles keep their spelling. (doc/) - The README walks through each core capability. After the install steps it gives the container and providers, the facades, models, routing and middleware, auth and authorisation, validation and forms, events, cache, localisation and testing their own section, each with a sample that compiles, a table of the members you reach for and the ways it fails. The sample model reads through
get<String>, asmake:modelgenerates it, andllms.txtfollows with the same sample and the same failure modes. (README.md,llms.txt) Vaultoperations finish in the order they were issued. Each read, write and delete waits for the ones issued before it, so on the web a token written before a sign-out can no longer land after the sign-out's delete. A platform call that never answers now stalls every laterVaultcall. (lib/src/security/magic_vault_service.dart)
Fixed
- Security: a token refresh can no longer cross accounts. When another account signed in, or the session ended, while a refresh was in the air, the refused request was replayed with the new account's token and the refreshed token could overwrite the new session's, in memory and in
Vault; a failed refresh could also log the new account out. A refresh now belongs to the session it started in: if that session changed, the refreshed token is discarded and the refused request is handed back without a retry or a logout, and a retry already on its way keeps the refreshed token instead of picking up the new session's. A sign-in no longer leaves the previous account's access or refresh token beside its own: it deletes the stored refresh token before writing its access token and writes its own refresh token last. A sign-in whose Vault writes fail puts the previous account's token back in memory and, as a best effort, as the stored access token, then rethrows; if that restoring write fails too (a keychain that stays locked), the new account's token can sit beside the previous account's cached user until the next user sync answers, and the previous refresh token may already be gone. A restore stops when a sign-in or a sign-out begins during its reads. (lib/src/auth/,doc/security/authentication.md) BaseGuard.storeTokennow marks a new session (upgrade note for custom guards). A token stored from outside is taken to be a sign-in, so a refresh still in the air can no longer write over it, and a stored refresh token is deleted unless the call passes a new one. Only a custom guard that rotates its own token throughstoreTokennotices: its in-flight boot sync is discarded, a refused request is handed back instead of retried, and a rotation without a refresh token drops the stored one. Rotate throughrefreshToken(), which keeps the session; it needs arefreshEndpoint, arefreshTokenKeyand a stored refresh token, and answersfalsewhen any of the three is missing. (lib/src/auth/guards/base_guard.dart)- The configuration page states how
env()really converts a value. It converts only for abool,intordoubletype argument (true,1andyesread astrue; an unparsable number falls back to the default) and returns the raw string otherwise, so(true)reads asfalseandnulloremptystay strings. The page no longer claims that process environment variables override.envat runtime: the file is a bundled asset andMagic.init()reads only it. (doc/getting-started/configuration.md) - The provider-list samples put
AppServiceProviderbeforeAuthServiceProvider. In the old order the user factory is not set when auth boots, so a stored session is never restored. (doc/getting-started/service-providers.md,doc/architecture/request-lifecycle.md) - Doc samples use only APIs that exist and compile. The facades page drops
Http.patch(there is nopatchverb), the installation page usesMagicRoute.page,UserController.instanceand a null check, the lifecycle page mixesMagicStateMixininto a controller that readsisEmpty, redirects throughredirectTargetand rebuilds throughrefreshUI(), the custom-rule sample returns its translation key frommessage(), the form-request sample authorises throughGate.allows, theFormRequestsample gives the valueprepared()injects a rule sovalidate()keeps it, and the DevTools page importscrumbsonce. (doc/) - Doc claims about lifecycle and wiring match the code.
onInitruns the first time a stateful view backs the controller, not when it is created; readingMagicRoute.configearly does not throw but freezes the router, so a later route, layout or observer registration throws; theSession.ticklistener is wired inmain()afterMagic.init(), since aboot()that readsrouterConfigcan freeze the router before the routes exist; the installer writes nolocalization.dart. The contribution guide listshelpers/,perf/andpolicies/, and the DevTools page gains its Related Documentation section. (doc/) - The installation page lists what
magic:installwrites, the facades page counts 13, and the example README matches the example. Underlib/app/the installer writes the two providers andkernel.dart, and the flag list gains--preserveand--with-devtools. The facades page lists the 13 files underlib/src/facades/and movesMagic,EnvandCarbon, which are classes, to a Related Classes table. The example README declares its real dependencies (magic,dowel,material_ui,cupertino_icons), nameslib/routes/app.dart, and quotesmagic_notifications: ^1.0.0; the skill's CLI reference saysmagic_devtoolsships its own skill. (doc/getting-started/installation.md,doc/architecture/facades.md,example/,skills/magic-framework/) - The
magic-frameworkagent skill teaches what the code and the installer do. Routes are registered inRouteServiceProvider.boot(), as themagic:installstub writes them, not inregister(); theSession.ticklistener is wired inmain()afterMagic.init()throughrouterConfig(there is noMagicRouter.instance.router); the stored-instance sample readsConfig.repository(there is noConfig.load()); the ORM error sample callssetErrorsFromMapand says an empty error map also covers a refused write (a 500 or a 403); and the attribute rule no longer contradicts the docs: a model reads through typed getters built onget<T>orgetAttribute(...) as T?, and code outside the model uses those getters. The skill gains an Install section, a shorter trigger description, recipes that compile as written, and plain statements in place of shouted rules. (skills/magic-framework/) MagicForm.onWillPopno longer sits on Flutter's deprecatedForm.onWillPop. The route now holds one pop veto (aPopEntry) for every guardedMagicFormon it. A back attempt asks each form's callback in turn and stops at the firstfalse; when all answertrue, the veto is lifted only whileNavigator.maybePopruns again, so the route closes once, with its own logic (a web overlay that closes through the browser still steps the browser back), unless another pop entry on the route (aPopScope(canPop: false)) still vetoes: that entry was notified by the back itself and is not notified again. A second back while the callbacks are pending is not asked again, and the route cannot be swiped away while a callback is set. As withmaybePop, an answer that arrives after the route, or the page holding its navigator, has left the top of the stack is dropped, and an approved back on the first route bubbles through each enclosing navigator, then out of the app (on Android that closes it, including for a programmaticmaybePop; the veto is back before the exit goes to the platform) instead of emptying the navigator. Three things change with the move to pop entries:Navigator.maybePopanswerstrueat once instead of waiting for your callback, an exception your callback throws is...
1.0.0
BREAKING
- The CLI moved from
fluttersdk_artisantodowel, and so did every name built on it. The executable isdart run magic:dowel <cmd>(there is noartisanexecutable any more),MagicArtisanProviderisMagicDowelProvider, the command base classes areDowelCommand,DowelGeneratorCommandandDowelContext, the stub override variable isDOWEL_STUBS_DIR, and project state lives in.dowel/instead of.artisan/. The executable hands over to the consumer'sbin/dispatcher.dartwhendart run dowel installhas scaffolded one, so plugin commands keep resolving. To upgrade an app:dart pub remove fluttersdk_artisananddart pub add dowel, move.artisan/to.dowel/(the install hashes survive), delete.dowel/plugins.json, thefluttersdk_*records under.dowel/installed/,bin/dispatcher.dart,bin/fsa, a leftoverbin/artisan.dart,lib/app/_plugins.g.dartandlib/app/commands/_index.g.dart, renameArtisan*classes in your own commands toDowel*, rundart run dowel installanddart run dowel commands:refresh, thendart run dowel plugin:install magicandplugin:install <package>for each plugin, so the registration lands in.dowel/plugins.json(a file a renamed plugin published earlier shows as anunmanaged-fileconflict: review it, then pass--force). The full recipe is in the dowel changelog; "Upgrading from 0.0.x" indoc/getting-started/installation.mdfollows it. (pubspec.yaml,bin/dowel.dart,lib/cli.dart,lib/src/cli/) - Wind moved from
fluttersdk_windtowind_kit, which builds onmaterial_ui, so the SDK floor is Dart 3.13 and Flutter 3.47.package:magic/magic.dartre-exportswind_kit.MagicApplicationbuilds itsMaterialAppfrompackage:material_ui/material_ui.dartand defaultslocalizationsDelegatestoGlobalMaterialLocalizations.delegatesfrom the same package, which bundles the Cupertino and Widgets delegates. An app importspackage:material_ui/material_ui.dartforMaterialApp,ThemeData,ColorsandMaterialColor(flutter pub add material_ui, thendart fix --apply --code=deprecated_member_use); Flutter's ownpackage:flutter/material.darttypes are not interchangeable with them.magic:installaddswind_kit,material_uianddowelto the app.flutter_localizationsis no longer a dependency of core. (pubspec.yaml,lib/src/foundation/magic_app_widget.dart,lib/src/cli/) - Four layers left core for plugin packages, and
package:magic/magic.dartno longer exports them.magic_encryptioncarriesCrypt,MagicEncrypter,EncryptionServiceProviderandkey:generate;magic_pickercarriesPickand theMagicFile.toXFile()andXFile.toMagicFile()conversions (XFileleaves core, andfromXFileis replaced bytoMagicFile) and thefile_picker,image_pickerandshare_plusre-exports;magic_socketcarriesEcho, the broadcasting manager, the Reverb and null drivers,ListensToBroadcastsandFakeBroadcastManager(nowpackage:magic_socket/testing.dart);magic_local_storagecarries the whole SQLite layer:DB,Schema, the query builder, migrations, seeders, factories,SyncFeedandSyncLedger. Add one withflutter pub add <package>thendart run magic:dowel plugin:install <package>. TheCryptpayload wire format is unchanged (AES-256-CBC,base64(iv):base64(ct)), so ciphertext written by 0.0.41 still decrypts. - Five facades are gone from core, so core has 13:
Auth,Cache,Config,Event,Gate,Http,Lang,Launch,Log,Route,Session,Storage,Vault.Crypt,DB,Echo,PickandSchemanow come from the plugins above. - The installer flags
--without-databaseand--without-broadcastingare removed, and so aremake:migration,make:seeder,make:factoryandkey:generate. Core ships 17make:*generators instead of 20.make:model -m/-f/-sandmake:resourcelook the migration, factory and seeder commands up in the dowel registry and print a hint to installmagic_local_storagewhen it is absent. make:controller --broadcastsis removed. MixListensToBroadcastsfrommagic_socketinto the controller by hand.Storage.downloadon IO throwsUnsupportedErrorunless a handler is set. Core no longer carriesshare_plus;magic_pickersets the newLocalAdapterContract.downloadHandlerso the file is shared as before. The web adapter is unchanged.Model.query()is gone from core. It is the extensionModelQueryinmagic_local_storage. A model withuseLocal => truethrows aStateErrornamingmagic_local_storageon every persistence leg when nothing is bound to thelocal_model_storecontainer key.Magic.seedis gone from core. UseSeeding.run(List<Seeder>)frommagic_local_storage.magic:installno longer registersDatabaseServiceProviderorBroadcastServiceProvider, so an app that needs one runsplugin:installfor its plugin. An app installed on 0.0.41 also has the publishedlib/config/database.dartandlib/config/broadcasting.dart. The plugins exportdatabaseConfigandbroadcastingConfigfrom their barrels, so delete those two files before runningplugin:install magic_local_storageorplugin:install magic_socket, or the import becomes ambiguous.- The record type of
FakeCacheManager.recordedisFakeCacheCall, notCacheRecord. A test that namesCacheRecordstops compiling: rename it toFakeCacheCall. The generic name collided with theCacheRecordclass of thecrumbsdev tool for any app that imports both barrels, and a test fake's record shape does not belong under a generic name inpackage:magic/magic.dart. The shape is unchanged:({String operation, String key, dynamic value}). (lib/src/testing/fake_cache_manager.dart)
Added
LocalModelStore, the one contract core keeps for local persistence.Modelresolves it from the container under'local_model_store', andmagic_local_storagebinds it. Core keeps the baseModel(API-first,useLocalfalse by default), casts,HasTimestamps,InteractsWithPersistence,model_eventsanddb_events. (lib/src/database/contracts/local_model_store.dart)LocalAdapterContract.downloadHandler, the seam that lets a plugin own the IO download. (lib/src/storage/drivers/local/local_adapter_contract.dart)
Changed
- First stable release: version 1.0.0 replaces the planned 0.1.0 and follows 0.0.41, so the 0.x caret trap is gone: a package on
magic: ^1.0.0takes every 1.x release. It requiresdowel ^1.0.0andwind_kit ^1.12.0; no API change beyond what is listed here. - The web local storage adapter reads and writes
localStoragedirectly. Keys (flutter.plus the path) and the json-encoded base64 value format are the same, so files stored by 0.0.41 stay readable. - The installer's
lib/main.dartpreview draws an in-repo unified diff instead of usingmore. - The
sqlite3floor is^3.9.1and thesqlite3.wasmpin moves to 3.9.1. Both now belong tomagic_local_storage, whoselocal_storage:installdownloads the wasm. magic:install --with-devtoolswires the tapir and crumbs debug trio.fluttersdk_duskandfluttersdk_telescopeare discontinued, so the flag addsmagic_devtools ^1.0.0,tapir ^1.0.0andcrumbs ^1.0.0todependenciesand writes theTapirPluginandCrumbsPluginblocks (with theExceptionWatcherandDumpWatcher) intolib/main.dartunder!kReleaseMode(debug and profile builds carry the tools, so a perf measurement runs on a profile build; release tree-shakes them), withMagicPerfIntegration.install()beforeMagic.init()andMagicTapirIntegrationandMagicCrumbsIntegrationafter it. A call already inlib/main.dartis never written twice, and an app already callingMagicDevtools.installPre(is left untouched. Its post-install message listsplugin:install tapir,plugin:install crumbs,tapir:installandcrumbs:install. (lib/src/cli/commands/magic_install_command.dart,install.yaml)- Every direct dependency constraint is raised to its latest release.
wind_kit^1.12.0,dowel^1.0.0,go_router^18.1.4 (the 17.x floor is gone),flutter_secure_storage^11.2.0,dio^5.11.1,logger^2.8.0,jiffy^6.4.5,meta^1.19.0 and the rest to their current patch.
Removed
- Ten dependencies leave core's
pubspec.yaml:more,sqlite3_flutter_libs,shared_preferences,encrypt,file_picker,image_picker,share_plus,web_socket_channel,sqlite3andfaker. A consumer that used one of them transitively adds it, or the plugin that now owns it, to its ownpubspec.yaml. (pubspec.yaml)
Fixed
- Five doc comments no longer carry bare angle brackets. pana reports
unintended_html_in_doc_commentfor them even thoughanalysis_options.yamlignores the lint, and the publish workflow requires full pana points. The generic types now sit inside backticks. (lib/src/actions/magic_action.dart,lib/src/cli/helpers/main_dart_smart_merger.dart,lib/src/database/eloquent/model.dart,lib/src/foundation/config_repository.dart,lib/src/ui/magic_form_data.dart) - An overlay route opened as a dialog puts a transparent Material above its panel, as the sheet does. The dialog route had no Material above the panel, so a bare
TextorWTextin it was drawn with the debug fallback style (a yellow double underline) where the same panel looked right as a sheet, and every panel had to bring its own. The Material paints nothing and does not absorb a tap, so the scrim around the panel still closes the dialog whencanDismissallows it; the panel still draws its own surface and size. (#285,lib/src/routing/magic_overlay_page.dart) - A transport failure is a failed response, so
fetchListandfetchOnereport an error instead of an empty list.DioNetworkDriveranswers a timeout or a dead link with status 0 ...
0.0.41
Changed
- Every sibling floor names this batch's release.
fluttersdk_windmoves^1.11.0to^1.11.1. The old range already admitted the new version, so a freshpub getresolves nothing differently; what changes is that the floor names the release magic is verified against. wind 1.11.1 only fixes a horizontally scrollingWDivpainting its border across the viewport, so nothing magic calls changes. (pubspec.yaml)
Fixed
- A layout's shell is a
MaterialPageon every go_router the constraint admits. TheShellRoutehad only abuilder, so go_router chose its page: aMaterialPagewhen it recognised aMaterialApp, aNoTransitionPageotherwise. go_router 18 recognises material_ui'sMaterialAppalone, so under Flutter's ownMaterialApp.router(whatMagicApplicationbuilds) the shell lost its page transition and its route stopped usingTheme.of(context).pageTransitionsTheme. The router now builds the page itself with the key, name, arguments and restoration id go_router 17 gave it, so 17 and 18 behave alike. (lib/src/routing/magic_router.dart)
Improvements
- The example's tips overlay opens as a centred dialog from 1024 px.
RouteServiceProviderinstalls aMagicRoute.useOverlayPresentationresolver, andWelcomeSheetViewdraws its own surface in both frames: a bottom sheet below, a centred card with four rounded corners above. A panel can tell the frame byModalRoute.of(context) is RawDialogRoute, so magic exposes nothing new for it. (example/)
0.0.40
Added
- An overlay route can open as a centred dialog instead of a bottom sheet.
MagicRoute.useOverlayPresentation((context) => ...)installs a resolver, asked once each time an overlay opens with the root navigator's context, that answersMagicOverlayPresentation.sheetor.dialog; magic itself holds no breakpoint, so the app decides (by window width, typically). The dialog is a bareDialogRouteon the root navigator with the sheet's scrim and no safe-area padding, so the panel draws its own surface. It shares the sheet's dismissal:canDismissread live (scrim and Escape off while it says no) and a user's close sent through the browser's Back on the web. Without a resolver every overlay stays the sheet it was, andMagicRouter.reset()drops the resolver. (lib/src/routing/magic_overlay_page.dart,lib/src/routing/magic_router.dart,lib/src/facades/route.dart)
0.0.39
Fixed
- An overlay sheet a refused drag slid shut under the guard's own question comes back when that question closes. A
canDismissthat refuses usually asks why in a route pushed over the sheet, so the sheet was no longer current when its fling ended and stayed shut, invisible, with the scrim swallowing every tap. The route now slides back up indidPopNextwhen it is still active, shut and the guard still refuses. (lib/src/routing/magic_overlay_page.dart)
0.0.38
BREAKING
MagicVaultService.macOsUsesDataProtectionKeychainis nowbool?, and an absentsecurity.vault.macos_data_protection_keychainmeans "probe" rather thantrue. Code that read the field as aboolno longer compiles. The config key stays as the explicit override, andtrueorfalseis honoured without a probe.
Added
- A route can open as a bottom sheet with its own URL.
RouteDefinition.overlay(base:, canDismiss:)makesto()always push the route as aModalBottomSheetRouteon the root navigator over the page on screen (a deep link or post-login redirect throughto()included);back(), the system back button and browser Back return to that page with its state, and the address bar shows the sheet's URL. A replacing arrival (the initial location, platform route information such as a reload, a go_routergo()) is redirected tobaseand the sheet is pushed over it in the next frame, only if the navigation actually landed onbase;MagicRoute.replace()to an overlay is not such an entry.basemust name another registered page route, and may declare parameters, filled from the overlay location, that the overlay path must also declare; otherwise the router throws aStateErrorwhen it builds.canDismissis asked before every close (scrim, drag, system back, browser Back,back(), ato()that replaces the stack, throughGoRoute.onExit) and turns the scrim and the drag off while it answers no; a refused browser Back keeps the sheet and the address bar on the sheet's URL. A secondto()for a sheet already on top (a double click) is ignored. On the web a cold load waits until the browser holds an entry forbasebefore it pushes the sheet, so the history is[base, sheet]and the first browser Back closes the sheet instead of leaving the app; a reload with the sheet open leavesbasein the history twice (measured in Chrome through Playwright). This is best effort until the user has interacted with the page: Chrome's history intervention lets its real Back button skip an entry added without a user gesture, which Playwright'sgoBackdoes not exercise. A guarded sheet takes a go_routeronExiton every platform, soNavigator.popUntilover it does not terminate, and a navigation issued while it is on top runs one event later so aNavigator.pop()just before it cannot drop it; a second pop of the same sheet in one event is refused instead of completing it twice. On the web, closing the sheet withMagicRoute.back(), a scrim tap or a drag steps the browser history back under the same rule as astacked()page (see Fixed), so a later browser Back does not reopen it; a panel that refuses the pop itself (PopScope(canPop: false), a refusingForm) keeps a scrim tap or Escape from moving the browser at all, aNavigator.popfrom the panel closes in the app and adds an entry, and aDraggableScrollableSheetthat closes by shrinking to its minimum does too (measured in Chrome). The frame is the oneshowModalBottomSheet(backgroundColor: Colors.transparent, isScrollControlled: true, useRootNavigator: true)builds, with no drag handle, no safe area and noconstraints; the route's widget is the panel, and it inherits the app-level themes rather than a layout's local ones. An overlay declared in a layout group keeps its prefix and middleware, opens above the shell, and is matched before the layout's pages, so its path must not also match a page path. While an overlay is on top, the title,currentPath,Request.route()and the query readers answer for the sheet, not for the page a layout builds beneath it. (lib/src/routing/magic_overlay_page.dart,lib/src/routing/magic_router.dart,lib/src/routing/route_definition.dart) MagicVaultService.usesDataProtectionKeychainreports the keychain in use.nulluntil the first operation has resolved it.MagicVaultException.statusCodeandisMissingEntitlementname the cause of a failed operation.statusCodeis theOSStatusthe keychain returned (taken from the wrappedPlatformException.details, since the exceptioncodeis the same string for every status), andisMissingEntitlementis true for -34018. A write that fails for want of the entitlement now says so in its message.
Changed
- The macOS Vault chooses its keychain on first use instead of assuming the data protection one. With no
security.vault.macos_data_protection_keychainconfig,MagicVaultServicewrites and deletes a throwaway item in the data protection keychain once. It keeps that keychain when the write works and falls back to the legacy login keychain, with oneLog.warning, when the keychain answerserrSecMissingEntitlement(-34018), which is what an ad-hoc build or one without a provisioning profile gets. Before this, everyVault.puton such a build failed and a sign-in showed only a generic error. The probe writes because a read of the data protection keychain on such a build finds nothing instead of failing. Any other probe failure surfaces as aMagicVaultExceptionand the next operation probes again. A signed build that was already on the data protection keychain keeps it. An app that fell back to the legacy keychain and is later signed with a profile moves to the data protection keychain and does not see its old items (there is no migration between the two); pinmacos_data_protection_keychain: falsefor such an app. A release build with no provisioning profile now stores in the legacy keychain, with one warning, instead of failing every write; set the key totrueto have it fail loudly instead. The legacy keychain ties an item to the signature that wrote it, so an ad-hoc build that is rebuilt can raise a system keychain prompt per stored item on its next launch: sign local builds with a stable identity. - The
fluttersdk_windfloor moves^1.9.0to^1.11.0. The old range already admitted 1.11.0, so a freshpub getresolves nothing differently; what changes is that the floor names the release magic is verified against. wind 1.9.1 to 1.11.0 add and fix without a break a consumer inherits (WButton,WPopoverandWSelectsemantics,WInputvertical centring and a locale decimal mark,WImageobject position,wWindowClassOf), and magic needed no change for them. The stack lines inCLAUDE.mdand.github/copilot-instructions.mdquote the new floor. (pubspec.yaml,CLAUDE.md,.github/copilot-instructions.md)
Fixed
to()on astacked()route decides "the screen already showing" from the top of the page stack. It read the location of the page whose builder ran last, which over a page inside a layout is the page beneath (the shell builds after the pushed page). The documented query swap (to('/monitors/42', queryParameters: {'tab': 'checks'})on/monitors/42) then pushed a second copy of the screen instead of swapping its tab, and twoto()calls for the same stacked route in one frame (a double click) pushed it twice. Both now behave as documented on every platform. (lib/src/routing/magic_router.dart)- On the web,
MagicRoute.back()from astacked()page no longer leaves the page behind the browser's Back. go_router reports every change of the page stack as a new history entry, soback()added the page underneath as a NEW entry, and the next browser Back reopened the page just closed.back()now closes a page pushed byMagicRoute.to()orMagicRoute.push()throughhistory.back()when the browser's current entry is the one that push created over the stack beneath (compared by the encoded stack, page keys included); the browser answers as it does its own Back button, so no entry is added and Forward reopens the page. A secondback()before the browser answers does nothing, and ato(),push()orreplace()issued meanwhile runs after it. A step the browser does not answer within a second is given up and the page stays; nothing closes in the app then, so a late answer closes it like a browser Back. Areplace(), including the query swapto()does on the screen already showing, gives up the claim, since go_router reports it as a new entry with the same page key. Every other close happens in the app as before and adds an entry:Navigator.popandpopUntilfrom app code (their synchronous pop is kept: no route gains a go_routeronExitfor this), a go_routercontext.push, two pushes in one frame, and any page after the app closed a page in the app. Native platforms are unchanged. Measured in Chrome; Safari, Firefox and mobile browsers were not measured. (lib/src/routing/magic_router.dart,lib/src/routing/browser_history_web.dart,lib/src/routing/browser_history_stub.dart)
0.0.37
Added
MagicImagedraws a network image from a copy kept on the device.MagicImage.of(url, {fallback, cacheWidth})answers anImageProviderthat reads the image from theimagesstorage disk when it is held and fetches it once when it is not, so a poster is a request the first time and never again, across launches. Afallbackaddress is the stand-in: it draws at once when held, the address replaces it when it lands, and when the address cannot be fetched the fallback is fetched and stays, with the address asked again afterretryAfter.MagicImageCacheowns the fetch and the retry window (five minutes by default), shares one request between two draws of a URL, trims the folder to 300 MiB least recently used first on the first use of a launch and again after a quarter of the cap has been written, and hasclear().MagicImageStoreis the folder, files named by the SHA-1 of the URL with atomic writes, andMagicImageWireis thedart:iofetch: http and https only, a JPEG, PNG, GIF or WebP body of at most 8 MiB, timeouts, and failures that never name the address. A key that failed, or a stand-in that outlived the retry window (noted per key, so the same address at anothercacheWidthretries too), is dropped from the memory cache so the next resolve loads again, and bytes that pass the signature check but do not decode are refused for the retry window instead of downloaded on every resolve. A fetched image the disk will not keep (a full disk) is drawn from memory and not held against the host: the cache throws aMagicImageNotStoredcarrying the bytes.clear()empties the folder and keeps the root, so the backup exclusion of the disk survives it. On the webMagicImage.ofanswers aNetworkImage, andMagicImageCache.instance.clear()andMagicImageExceptionexist there so shared sign-out code compiles. Declare the disk in the app'sfilesystemsconfig with'exclude_from_backup': true(defaultFilesystemsConfigcarries the entry, whichMagic.initdoes not merge by itself); a disk that is not declared or cannot be opened leaves images drawn with no copy kept, with one warning logged.cryptobecomes a direct dependency. (lib/src/storage/images/)- A local disk can keep its root out of iCloud and Time Machine backup. Setting
'exclude_from_backup': trueon alocaldisk marks its root directory withkCFURLIsExcludedFromBackupKeyon iOS and macOS, throughdart:ffiinto CoreFoundation, on the first path the disk resolves, whether it created the directory or found it there. Files under the root inherit the exclusion, which suits large downloads the app can fetch again. A refused mark throws aFileSystemExceptioninstead of resolving the path. The key defaults tofalse, and it does nothing on Android, Windows, Linux or the web; a disk without it behaves as before. (lib/src/storage/storage_manager.dart,lib/src/storage/drivers/local/backup_exclusion_io.dart,lib/src/storage/drivers/local/local_adapter_io.dart)
0.0.36
Added
MagicDecryptExceptionis exported frompackage:magic/magic.dart.Crypt.decryptandCrypt.decryptWithDeviceKeydocumenton MagicDecryptException, but the type was not in the barrel, so a caller could only catch a bareException. (lib/magic.dart)MagicTest.bootProvidersandMagicTest.disposeBooted.bootProviders(providers)registers every provider and then boots every provider, in list order, the wayMagic.initdoes, without loading an env file or config.disposeBooted()disposes the registered controllers newest first, detachesSessionScope, resetsMagicRouterand flushes the container, covering whatMagic.flush()leaves behind. (lib/src/testing/magic_test.dart)references/plugin-device.md, the skill's page formagic_device0.0.1. The ecosystem plugin table, the reference index and the skill's trigger line now name the package, and the page coversDevicePower(the mains-power gate with itstelevisionpredicate, and howidleis measured per platform),WindowFullscreen(the shared instance,activeagainsttargetandtransitioning, the will and did notifications onmagic_device/window, whattoggle()refuses), theBatteryStatere-export, and testing through injected readers. (skills/magic-framework/)
0.0.35
Fixed
- A web tab keeps its page title after the router moves on. Chrome keeps a tab title per history entry. After a page builds, the Flutter engine calls
history.pushStateorreplaceStateto report the route, and the title written during that build did not follow the new entry: the tab fell back to the previous entry's title, or to the bare host, whiledocument.titlestill read correctly. Blink only reports a title to the browser when it changes, so writing the same one again did nothing, and the tab stayed wrong until the next navigation.MagicApplicationnow re-sends the title after every change of the browser's current history entry (a title written with a zero-width suffix, then the real one) through the Navigation API; where the browser has none, and on every other platform, nothing changes. (lib/src/routing/tab_title_sync.dart,lib/src/foundation/magic_app_widget.dart)
0.0.34
Fixed
- A picked file uploads from a release web build.
Http.uploadrecognised aMagicFileor anXFileby comparingruntimeType.toString()with the class name, and dart2js minifies class names in a release build, so on the web every file fromPickwas refused withUnsupported file type: minified:..before a request left the browser. Debug runs and tests were unaffected, which is why it shipped. The driver now uses type tests. (lib/src/network/drivers/dio_network_driver.dart)