The Offline-First Strategy Engine: Inside Beariscope

How an open-source Flutter app uses spatial mapping and local caching to orchestrate robotics strategy when stadium Wi-Fi inevitably fails.

8 min read • bear-metal-apps/beariscope

A rugged tablet glowing brightly amid broken wireless signals in a chaotic stadium concourse, representing offline stability.
When thousands of devices flood a stadium, local caching ensures the drive team's strategy dashboard remains fully operational.
Key Takeaways

The Stadium Blackout

The FIRST Robotics Competition (FRC) environment is hostile to modern web applications. When a high school stadium fills with thousands of students, robots, and access points, local Wi-Fi spectrums are entirely obliterated. This phenomenon is known as the "pit effect." In this environment, a cloud-dependent web application is not just slow. It is an active liability.

Drive coaches have exactly two minutes to formulate an alliance strategy before a match begins. They need immediate access to historical performance metrics, robot capabilities, and subjective scouting notes. Waiting for a network timeout is not an option.

Beariscope, built by FRC Team 2046 (Bear Metal), solves this problem by aggressively moving data to the edge. Written in Dart and built on the Flutter framework, it targets multi-platform desktop and mobile environments. By compiling to native desktop executables for Windows and Linux, Beariscope ensures that high-powered strategy workstations in the pits operate independently of the stadium's failing infrastructure.

Mapping the Chaos

Most scouting applications present data in endless, scrolling lists. Beariscope treats the physical geometry of the competition venue as a first-class data object. The repository includes a dedicated PitsMapView that translates raw JSON coordinates into a spatial interface.

This allows strategy teams to physically locate their alliance partners in a chaotic stadium. The architecture leverages Flutter's CustomPaint for the decorative floor plan and an InteractiveViewer for the team locations. This layered approach ensures that panning and zooming remain highly performant, even on low-end tablets.

A spatial mapping flow showing how Beariscope translates competition venue layouts into interactive interfaces. Show a raw JSON blueprint file on the left

The Offline-First Engine

The core of Beariscope's resilience lives in scouting_data_provider.dart. The application utilizes a rigorous stale-while-revalidate pattern powered by Riverpod and a local Hive NoSQL database.

When a user opens a team profile, Beariscope does not ask the network for data. It instantly serves the cached state directly from the local Hive box. Simultaneously, a background process attempts to fetch updates from the cloud API. If the network drops, the application silently swallows the error and preserves the UI state.

A sturdy local water reservoir instantly pouring a solid stream into a beaker, while a thin pipe slowly drips refills from above.
The stale-while-revalidate pattern allows the UI to render instantly from local disk while hunting for network updates in the background.

This approach requires careful state management. Beariscope manually encodes mapping dictionaries back into JSON strings before storing them in Hive. While less elegant than auto-generated TypeAdapters, this manual serialization is highly resilient to the rapid, mid-season schema changes typical of FRC scouting operations.

Future<void> _fetchAndUpsert() async {
  // 1. Immediately yield local Hive data
  state = AsyncData(_readFromHive());
  
  try {
    // 2. Attempt network fetch in the background
    final newData = await api.fetchScoutingData();
    // 3. Update Hive and UI only on success
    _writeToHive(newData);
    state = AsyncData(newData);
  } catch (e) {
    // 4. Silently fail; preserve existing cached UI
    print('Network sync failed, retaining local state.');
  }
}

The Bundle Pattern

Robotics data is inherently messy. A team might have pit scouting data detailing their robot's physical dimensions from a Friday morning, but match performance metrics from Saturday afternoon. These documents are stored independently.

Beariscope solves this fragmentation through the TeamScoutingBundle. This model layer acts as an aggregator, pulling disparate JSON documents together and abstracting all mathematical calculations away from the UI layer. Instead of a Flutter widget calculating averages, the bundle provides clean getter methods like avgMatchField and modalMatchField. This keeps the presentation layer entirely focused on rendering the strategy dashboard.

Strategy Over Scouting

The open-source ecosystem for FRC is saturated with data entry tools. Beariscope stands out because it focuses on data consumption.

While tools like BEARSscouts and FalconScout excel at getting numbers into a database via QR codes, and StrategyBoard2025 provides a digital canvas for drawing plays, Beariscope attempts to unify the pipeline. It takes the aggregated data and presents it under a unified, spatial, offline-first interface designed specifically for the two-minute warning.

Project Primary Function Offline Strategy UI Paradigm
Beariscope Strategy & Decision Support Hive NoSQL Local Cache Spatial Maps & Dashboards
FalconScout Data Entry & Collection QR Code Data Transfer Dynamic Forms
StrategyBoard2025 Match Planning Progressive Web App (PWA) Digital Whiteboard

By treating the physical environment as a core design constraint rather than an edge case, Beariscope provides a blueprint for how to build robust, edge-first applications in fundamentally unreliable environments.


Sources