Urgent.News

What's breaking now, across thousands of outlets.

Tech

Your Flutter 404 Page Is Probably Crashing, and Your Server Is Probably Lying About It

Someone sent me a screenshot of my own 404 page. Washed-out grey text on a light background, barely readable, nothing like the dark theme every other page uses. My first thought was a styling bug. It was not a styling bug. The page was crashing before it could paint, and the fallback I had built for exactly that case was doing its job. Underneath it was a second bug that had been hiding the first…

Your Flutter 404 page might be crashing due to a couple of bugs in the code. The first issue is that the status code is being incorrectly returned as 200 instead of 404. This happens because the Firebase Hosting service serves a catch-all rewrite with a 200 status code for any unmatched URL. As a result, every non-existent URL on the site is indexed as a real page, leading to what is known as a soft 404.

This issue can be resolved by removing the catch-all rewrite and allowing the server to serve the actual 404.html page with a 404 status code.

The second bug is related to the page crashing while it should be displaying the content instead of a washed-out grey theme. This issue occurs because the prerendered HTML carries the page's text in the DOM, but it is clipped to a single pixel, which reveals only when Flutter never paints. This is a boot guard that works correctly on real routes but fails on the 404 page, as there is no route subtree above it to inherit the GoRouterState.

To fix this issue, developers can try using GoRouter.of(context).state.uri.path or GoRouter.state.uri.path, but both approaches fail due to the empty matches list on unmatched URLs. A workaround is to catch the exception and use Uri.base.path as a fallback.

Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.

Read the original at dev.to →

More in Tech

A Squarified Treemap by Hand, Because Charting Packages Cannot Drill Down

Helm's storage tool shows your disk as a treemap: every folder a rectangle, every rectangle sized by how much space it takes.

  • Author manually creates treemap visualization of disk space
  • Squarified algorithm preferred for readable, visually appealing rectangles
  • Additional features needed for accurate, usable disk browser interface

The DNS Field That Could Run Anything as Root

Sonar has a Control tab. One of the things it does is switch the DNS resolver for your Mac — tap Cloudflare, tap Quad9, or paste in the address of your own Pi-hole.

  • DNS field in Sonar app allows users to set preferred DNS server
  • Command-injection vulnerability enables code execution with root privileges
  • Input validation and secure storage needed to prevent unauthorized access

What It Actually Takes to Run a Cross-Border Marketplace: Six Years of Shpper

Shpper is a cross-border personal-shopping marketplace. A buyer wants something they cannot get where they live. A traveller is already flying that route with unused luggage space.

  • Shpper connects buyers with travellers sharing empty luggage space on flights
  • Platform holds funds in escrow until item confirmed delivered, ensuring trust
  • CTO oversees engineering and business aspects, managing state machine and policies

More from Sunday 6 September →