{"id":10501,"date":"2026-07-11T12:34:19","date_gmt":"2026-07-11T07:04:19","guid":{"rendered":"https:\/\/pheonixsolutions.com\/blog\/?p=10501"},"modified":"2026-07-11T12:34:46","modified_gmt":"2026-07-11T07:04:46","slug":"architecting-interactive-3d-companion-avatars-cache-first-ui-implementation-and-firebase-storage-integration-in-flutter","status":"publish","type":"post","link":"https:\/\/pheonixsolutions.com\/blog\/architecting-interactive-3d-companion-avatars-cache-first-ui-implementation-and-firebase-storage-integration-in-flutter\/","title":{"rendered":"Architecting Interactive 3D Companion Avatars: Cache-First UI Implementation and Firebase Storage Integration in Flutter"},"content":{"rendered":"\n<h3 class=\"wp-block-heading\"><strong>Objective<\/strong><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">The objective of this module is to design and implement an <strong>interactive 3D Avatar Companion viewer<\/strong> within a mobile application. The engine provides users with a fluid interface to discover, download, cache, and interact with live-rendered 3D models (<code>.glb<\/code> files) while executing structural animations directly on the client view.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Requirements<\/strong><\/h3>\n\n\n\n<h4 class=\"wp-block-heading\"><strong>Functional Requirements<\/strong><\/h4>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Dynamic Model Discovery:<\/strong> Automatic listing of remote asset folders without hardcoding identifiers.<\/li>\n\n\n\n<li><strong>On-Demand Dynamic Download:<\/strong> Direct downloading of heavy 3D assets (~35MB) with accurate, real-time progress percentages.<\/li>\n\n\n\n<li><strong>Cache-First Loading Architecture:<\/strong> local lookup engine that bypasses network requests if an asset is already verified on disk.<\/li>\n\n\n\n<li><strong>Live 3D Viewport:<\/strong> Interactive 3D canvas supporting multi-touch rotation and zoom configurations.<\/li>\n\n\n\n<li><strong>Animation Mapping &amp; Discovery:<\/strong> Dynamic extraction and formatting of embedded animation clips directly out of the rendered model.<\/li>\n<\/ul>\n\n\n\n<h4 class=\"wp-block-heading\"><strong>Non-Functional Requirements<\/strong><\/h4>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Memory Management:<\/strong> Separation of metadata tracking from large binary file paths on disk.<\/li>\n\n\n\n<li><strong>UI\/UX Polishing:<\/strong> Shared Element transitions (<code>Hero<\/code> tags) and strict alignment grids to avoid component sizing layout shifts during scrolling.<\/li>\n\n\n\n<li><strong>Offline Resiliency:<\/strong> Complete asset viewing functionality during network dropouts once cached.<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Pre-Requisites<\/strong><\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Stateful Architecture:<\/strong> Flutter framework utilizing robust <code>StatefulWidget<\/code> lifecycle hooks.<\/li>\n\n\n\n<li><strong>NoSQL Key-Value Store:<\/strong> Hive configured for fast key-value local metadata tracking.<\/li>\n\n\n\n<li><strong>Backend Storage Infrastructure:<\/strong> Firebase Cloud Storage buckets configured for dynamic asset storage.<\/li>\n\n\n\n<li><strong>3D Native Plugin Layer:<\/strong> <code>flutter_3d_controller<\/code> integrated into the native layer.<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Solutions<\/strong><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">The implementation builds a seamless, high-performance runtime loop:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Decoupled Architecture Concerns:<\/strong> Distributed logic across <code>AvatarStorageService<\/code> (remote fetch network tier) and <code>AvatarCacheService<\/code> (local disk caching manifest layer).<\/li>\n\n\n\n<li><strong>Sanitized String Formatters:<\/strong> Client-side parsing that dynamically maps raw, underscores-heavy animation clip names into readable Title Case labels while passing the expected raw names back to the engine.<\/li>\n\n\n\n<li><strong>Stale Record Invalidation:<\/strong> Automatic verification checks that validate manifest references against physical on-disk file availability to heal corrupted app-data states.<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>High-Level Design (HLD)<\/strong><\/h3>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2026\/07\/Screenshot-2026-07-11-at-12.12.03-PM.png\"><img fetchpriority=\"high\" decoding=\"async\" width=\"828\" height=\"1024\" src=\"https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2026\/07\/Screenshot-2026-07-11-at-12.12.03-PM-828x1024.png\" alt=\"\" class=\"wp-image-10503\" srcset=\"https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2026\/07\/Screenshot-2026-07-11-at-12.12.03-PM-828x1024.png 828w, https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2026\/07\/Screenshot-2026-07-11-at-12.12.03-PM-242x300.png 242w, https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2026\/07\/Screenshot-2026-07-11-at-12.12.03-PM-768x950.png 768w, https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2026\/07\/Screenshot-2026-07-11-at-12.12.03-PM.png 876w\" sizes=\"(max-width: 828px) 100vw, 828px\" \/><\/a><\/figure>\n<\/blockquote>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Low-Level Design (LLD)<\/strong><\/h3>\n\n\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2026\/07\/Screenshot-2026-07-11-at-12.10.08-PM.png\"><img decoding=\"async\" width=\"1024\" height=\"939\" src=\"https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2026\/07\/Screenshot-2026-07-11-at-12.10.08-PM-1024x939.png\" alt=\"\" class=\"wp-image-10502\" srcset=\"https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2026\/07\/Screenshot-2026-07-11-at-12.10.08-PM-1024x939.png 1024w, https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2026\/07\/Screenshot-2026-07-11-at-12.10.08-PM-300x275.png 300w, https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2026\/07\/Screenshot-2026-07-11-at-12.10.08-PM-768x704.png 768w, https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2026\/07\/Screenshot-2026-07-11-at-12.10.08-PM-327x300.png 327w, https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2026\/07\/Screenshot-2026-07-11-at-12.10.08-PM.png 1254w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Tech Stack<\/strong><\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Framework:<\/strong> Flutter (Dart)<\/li>\n\n\n\n<li><strong>3D Renderer:<\/strong> <code>flutter_3d_controller<\/code> (<code>.glb<\/code> parser)<\/li>\n\n\n\n<li><strong>Cloud Infrastructure:<\/strong> Firebase Storage<\/li>\n\n\n\n<li><strong>Local Caching Manifest:<\/strong> Hive Database<\/li>\n\n\n\n<li><strong>Device Storage Utility:<\/strong> <code>path_provider<\/code><\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Challenges<\/strong><\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Manifest Desynchronization:<\/strong> An entry might exist in the database, but OS storage utilities or user interventions could clear physical app data files. This was handled by checking explicit <code>.exists()<\/code> metrics before accepting cache truth.<\/li>\n\n\n\n<li><strong>Visual Grid Inconsistencies:<\/strong> Custom horizontally scrollable buttons with varying text lengths caused layout visual imbalances. This was solved by utilizing a custom <code>ConstrainedBox<\/code> wrapper forcing standardized minimum sizing blocks.<\/li>\n\n\n\n<li><strong>SDK Version Drift:<\/strong> Component APIs across native 3D viewport plugins frequently alter call sign signatures. This required isolating animation querying explicitly to post-rendered runtime execution checks.<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>FAQ<\/strong><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>1. Are the large 3D models stored inside the database?<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">No. The ~35MB binary files are saved strictly as flat files in the local filesystem storage path. The database only tracks structural metadata maps pointing to where those items live.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>2. How does the application format underscore-heavy clip identifiers safely?<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">We separate presentation names from engine values using a split utility string formatter. It changes names into Title Case for user interaction buttons while feeding the exact original raw ID back down to the 3D rendering pipeline.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>3. What happens if an item source changes inside Firebase Storage?<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The cache strategy uses a cache-first approach. If an object definition updates on the cloud repository, a clear function must be invoked to wipe the local manifest and reload the updated binary model.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>4. Can users switch animations smoothly mid-render?<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Yes. Because animations are natively evaluated directly inside the loaded 3D asset scene viewport, firing controller actions triggers immediate runtime shifts without requiring a clean view redraw.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Objective The objective of this module is to design and implement an interactive 3D Avatar Companion viewer within a mobile [&hellip;]<\/p>\n","protected":false},"author":537,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"default","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","ast-disable-related-posts":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"default","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2},"jetpack_post_was_ever_published":false},"categories":[1],"tags":[],"class_list":["post-10501","post","type-post","status-publish","format-standard","hentry","category-uncategorized","psol-cat-uncategorized"],"jetpack_publicize_connections":[],"jetpack_shortlink":"https:\/\/wp.me\/phn2x7-2Jn","jetpack_sharing_enabled":true,"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/posts\/10501","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/users\/537"}],"replies":[{"embeddable":true,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/comments?post=10501"}],"version-history":[{"count":1,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/posts\/10501\/revisions"}],"predecessor-version":[{"id":10504,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/posts\/10501\/revisions\/10504"}],"wp:attachment":[{"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/media?parent=10501"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/categories?post=10501"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/tags?post=10501"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}