Steven Traykovski
ยทFlutterFlow Developer

Custom Widget and FlutterFlowTheme error on IOS

Custom Code

I created a custom widget that works ok on Web and Chrome, but when I test it on the IOS Simulator, am running into an issue with how the widget is using the FlutterFlowTheme library.

Any ideas for how to disable the theme, or force the custom widget to use default variables if it encounters a null variable? Hoping to fix this in the FF platform and not make the change in the downloaded code if I can.

The error message is:

EXCEPTION CAUGHT BY WIDGETS LIBRARY โ•žโ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ• The following _TypeError was thrown building HomePageWidget(dirty, dependencies: [InheritedCupertinoTheme, MediaQuery, _InheritedProviderScope<FFAppState?>, _InheritedTheme, _LocalizationsScope-[GlobalKey#a0971]], state: _HomePageWidgetState#8f8f5): Null check operator used on a null value The relevant error-causing widget was: HomePageWidget HomePageWidget:file:///Users/steventraykovski/Library/Application%20Support/io.flutterflow.prod.mac/search_this_area_map_demo/lib/flutter_flow/nav/nav.dart:51:36

When the exception was thrown, this was the stack: #0 _HomePageWidgetState.build (package:search_this_area_map_demo/pages/home_page/home_page_widget.dart:136:66)


When I inspect that line in my downloaded code, this is what's present (line 136 is the letterSpacing line):

decoration: InputDecoration(
                                isDense: true,
                                labelStyle: FlutterFlowTheme.of(context)
                                    .labelMedium
                                    .override(
                                      fontFamily: 'Manrope',
                                      letterSpacing: 0.0,
                                    ),

Is it possible the custom widget it compiling before the FlutterFlowTheme is fully initialized?

thanks for any guidance!

What have you tried so far?

full debugging and lots of chatgpt discussion!

Did you check FlutterFlow's Documentation for this topic?
Yes
2
1 reply