FlutterFlow / flutterflow-issues

A community issue tracker for FlutterFlow.
127 stars 26 forks source link

Invalid argument(s): No host specified in URI file:/// - Auth User not loading #1995

Closed sanchez-gonzalo94 closed 10 months ago

sanchez-gonzalo94 commented 11 months ago

Has your issue been reported?

Current Behavior

Recurring error on crashlytics: "Invalid argument(s): No host specified in URI file:///".

I have this recurring error on crashlytics. I downloaded the code and found out that the currentUserDocument is being initialized a second after the page is loaded and thus I get the error mentioned above due to the currentUserDocument == null.

This is the same with all of the authenticated user fields.

Example code:

import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_animate/flutter_animate.dart';
import 'package:provider/provider.dart';

import '/auth/firebase_auth/auth_util.dart';
import '/flutter_flow/flutter_flow_animations.dart';
import '/flutter_flow/flutter_flow_theme.dart';
import '/flutter_flow/flutter_flow_util.dart';
import 'home_page_model.dart';

export 'home_page_model.dart';

class HomePageWidget extends StatefulWidget {
  const HomePageWidget({Key? key}) : super(key: key);

  @override
  _HomePageWidgetState createState() => _HomePageWidgetState();
}

class _HomePageWidgetState extends State<HomePageWidget> with TickerProviderStateMixin {
  late HomePageModel _model;

  @override
  void initState() {
    super.initState();
    _model = createModel(context, () => HomePageModel());

    WidgetsBinding.instance.addPostFrameCallback((_) => setState(() {}));
  }

  @override
  void dispose() {
    _model.dispose();

    super.dispose();
  }

  @override
  Widget build(BuildContext context) {
    if (isiOS) {
      SystemChrome.setSystemUIOverlayStyle(
        SystemUiOverlayStyle(
          statusBarBrightness: Theme.of(context).brightness,
          systemStatusBarContrastEnforced: true,
        ),
      );
    }

    context.watch<FFAppState>();
    return Align(
      alignment: AlignmentDirectional(1.00, 0.00),
      child: Padding(
        padding: EdgeInsetsDirectional.fromSTEB(2, 0, 0, 0),
        child: Container(
          width: 48,
          height: 48,
          decoration: BoxDecoration(
            color: FlutterFlowTheme.of(context).secondaryBackground,
            shape: BoxShape.circle,
            border: Border.all(
              color: FlutterFlowTheme.of(context).black600,
              width: 1,
            ),
          ),
          child: Image.network(currentUserPhoto),
        ),
      ),
    );
  }
}

After the document has been loaded then the error goes away.

Expected Behavior

The auth user should load before the entry page is loaded.

Steps to Reproduce

A firebase project need to be configured.

  1. Set up firebase project.
  2. Set up a login/register page to create an auth account.
  3. Upload a profile picture and set it to the photo url attribute in the document.
  4. Create a home page.
  5. Create an image widget and set the photo url to the image.
  6. Add crashlytics (optional).
  7. Download code and start app.
  8. The error should appear.

Reproducible from Blank

Bug Report Code (Required)

IT40lfLqw5ZOxLlE17rAdflFqDw5JlAma4IRl+5RaDcqGOv2BOwQacmkclFoUtemTG9bKEWJoD8G+tr7jofXMvADFzSeGbZc+pFxWAzybEa/aoSpDbjpQ3BfMJhQJ2bA0bu3hiJDOu5eSXg/2F2UC++WTizYO5/6Zwh9f6PHaOI=

Context

This issue is not directly affecting my development but it is definitely noticeable in the crashlytics and i'm not sure what can be the affect in the app's perfomance.

Visual documentation

`======== Exception caught by image resource service ================================================ The following ArgumentError was thrown resolving an image codec: Invalid argument(s): No host specified in URI file:///

When the exception was thrown, this was the stack:

0 _HttpClient._openUrl (dart:_http/http_impl.dart:2751:9)

1 _HttpClient.getUrl (dart:_http/http_impl.dart:2627:48)

2 NetworkImage._loadAsync (package:flutter/src/painting/_network_image_io.dart:124:59)

3 NetworkImage.loadImage (package:flutter/src/painting/_network_image_io.dart:84:14)

4 ImageProvider.resolveStreamForKey. (package:flutter/src/painting/image_provider.dart:529:39)

5 ImageCache.putIfAbsent (package:flutter/src/painting/image_cache.dart:381:22)

6 ImageProvider.resolveStreamForKey (package:flutter/src/painting/image_provider.dart:526:81)

7 ScrollAwareImageProvider.resolveStreamForKey (package:flutter/src/widgets/scroll_aware_image_provider.dart:105:19)

8 ImageProvider.resolve. (package:flutter/src/painting/image_provider.dart:374:9)

9 ImageProvider._createErrorHandlerAndKey. (package:flutter/src/painting/image_provider.dart:488:24)

10 SynchronousFuture.then (package:flutter/src/foundation/synchronous_future.dart:41:39)

11 ImageProvider._createErrorHandlerAndKey (package:flutter/src/painting/image_provider.dart:485:9)

12 ImageProvider.resolve (package:flutter/src/painting/image_provider.dart:371:5)

13 _ImageState._resolveImage (package:flutter/src/widgets/image.dart:1111:16)

14 _ImageState.didChangeDependencies (package:flutter/src/widgets/image.dart:1061:5)

15 StatefulElement._firstBuild (package:flutter/src/widgets/framework.dart:5448:11)

16 ComponentElement.mount (package:flutter/src/widgets/framework.dart:5273:5)

... Normal element mounting (38 frames)

54 Element.inflateWidget (package:flutter/src/widgets/framework.dart:4182:16)

55 Element.updateChild (package:flutter/src/widgets/framework.dart:3701:20)

56 SingleChildRenderObjectElement.update (package:flutter/src/widgets/framework.dart:6441:14)

57 Element.updateChild (package:flutter/src/widgets/framework.dart:3685:15)

58 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:5322:16)

59 Element.rebuild (package:flutter/src/widgets/framework.dart:5016:7)

60 StatelessElement.update (package:flutter/src/widgets/framework.dart:5373:5)

61 Element.updateChild (package:flutter/src/widgets/framework.dart:3685:15)

62 SingleChildRenderObjectElement.update (package:flutter/src/widgets/framework.dart:6441:14)

63 Element.updateChild (package:flutter/src/widgets/framework.dart:3685:15)

64 SingleChildRenderObjectElement.update (package:flutter/src/widgets/framework.dart:6441:14)

65 Element.updateChild (package:flutter/src/widgets/framework.dart:3685:15)

66 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:5322:16)

67 StatefulElement.performRebuild (package:flutter/src/widgets/framework.dart:5462:11)

68 Element.rebuild (package:flutter/src/widgets/framework.dart:5016:7)

69 StatefulElement.update (package:flutter/src/widgets/framework.dart:5485:5)

70 Element.updateChild (package:flutter/src/widgets/framework.dart:3685:15)

71 SingleChildRenderObjectElement.update (package:flutter/src/widgets/framework.dart:6441:14)

72 Element.updateChild (package:flutter/src/widgets/framework.dart:3685:15)

73 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:5322:16)

74 StatefulElement.performRebuild (package:flutter/src/widgets/framework.dart:5462:11)

75 Element.rebuild (package:flutter/src/widgets/framework.dart:5016:7)

76 StatefulElement.update (package:flutter/src/widgets/framework.dart:5485:5)

77 Element.updateChild (package:flutter/src/widgets/framework.dart:3685:15)

78 SingleChildRenderObjectElement.update (package:flutter/src/widgets/framework.dart:6441:14)

79 Element.updateChild (package:flutter/src/widgets/framework.dart:3685:15)

80 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:5322:16)

81 StatefulElement.performRebuild (package:flutter/src/widgets/framework.dart:5462:11)

82 Element.rebuild (package:flutter/src/widgets/framework.dart:5016:7)

83 StatefulElement.update (package:flutter/src/widgets/framework.dart:5485:5)

84 Element.updateChild (package:flutter/src/widgets/framework.dart:3685:15)

85 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:5322:16)

86 StatefulElement.performRebuild (package:flutter/src/widgets/framework.dart:5462:11)

87 Element.rebuild (package:flutter/src/widgets/framework.dart:5016:7)

88 StatefulElement.update (package:flutter/src/widgets/framework.dart:5485:5)

89 Element.updateChild (package:flutter/src/widgets/framework.dart:3685:15)

90 SingleChildRenderObjectElement.update (package:flutter/src/widgets/framework.dart:6441:14)

91 Element.updateChild (package:flutter/src/widgets/framework.dart:3685:15)

92 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:5322:16)

93 StatefulElement.performRebuild (package:flutter/src/widgets/framework.dart:5462:11)

94 Element.rebuild (package:flutter/src/widgets/framework.dart:5016:7)

95 StatefulElement.update (package:flutter/src/widgets/framework.dart:5485:5)

96 Element.updateChild (package:flutter/src/widgets/framework.dart:3685:15)

97 SingleChildRenderObjectElement.update (package:flutter/src/widgets/framework.dart:6441:14)

98 Element.updateChild (package:flutter/src/widgets/framework.dart:3685:15)

99 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:5322:16)

100 StatefulElement.performRebuild (package:flutter/src/widgets/framework.dart:5462:11)

101 Element.rebuild (package:flutter/src/widgets/framework.dart:5016:7)

102 StatefulElement.update (package:flutter/src/widgets/framework.dart:5485:5)

103 Element.updateChild (package:flutter/src/widgets/framework.dart:3685:15)

104 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:5322:16)

105 StatefulElement.performRebuild (package:flutter/src/widgets/framework.dart:5462:11)

106 Element.rebuild (package:flutter/src/widgets/framework.dart:5016:7)

107 StatefulElement.update (package:flutter/src/widgets/framework.dart:5485:5)

108 Element.updateChild (package:flutter/src/widgets/framework.dart:3685:15)

109 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:5322:16)

110 Element.rebuild (package:flutter/src/widgets/framework.dart:5016:7)

111 StatelessElement.update (package:flutter/src/widgets/framework.dart:5373:5)

112 Element.updateChild (package:flutter/src/widgets/framework.dart:3685:15)

113 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:5322:16)

114 StatefulElement.performRebuild (package:flutter/src/widgets/framework.dart:5462:11)

115 Element.rebuild (package:flutter/src/widgets/framework.dart:5016:7)

116 StatefulElement.update (package:flutter/src/widgets/framework.dart:5485:5)

117 Element.updateChild (package:flutter/src/widgets/framework.dart:3685:15)

118 SingleChildRenderObjectElement.update (package:flutter/src/widgets/framework.dart:6441:14)

119 Element.updateChild (package:flutter/src/widgets/framework.dart:3685:15)

120 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:5322:16)

121 Element.rebuild (package:flutter/src/widgets/framework.dart:5016:7)

122 ProxyElement.update (package:flutter/src/widgets/framework.dart:5628:5)

123 _InheritedNotifierElement.update (package:flutter/src/widgets/inherited_notifier.dart:107:11)

124 Element.updateChild (package:flutter/src/widgets/framework.dart:3685:15)

125 SingleChildRenderObjectElement.update (package:flutter/src/widgets/framework.dart:6441:14)

126 Element.updateChild (package:flutter/src/widgets/framework.dart:3685:15)

127 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:5322:16)

128 StatefulElement.performRebuild (package:flutter/src/widgets/framework.dart:5462:11)

129 Element.rebuild (package:flutter/src/widgets/framework.dart:5016:7)

130 StatefulElement.update (package:flutter/src/widgets/framework.dart:5485:5)

131 Element.updateChild (package:flutter/src/widgets/framework.dart:3685:15)

132 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:5322:16)

133 Element.rebuild (package:flutter/src/widgets/framework.dart:5016:7)

134 ProxyElement.update (package:flutter/src/widgets/framework.dart:5628:5)

135 Element.updateChild (package:flutter/src/widgets/framework.dart:3685:15)

136 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:5322:16)

137 Element.rebuild (package:flutter/src/widgets/framework.dart:5016:7)

138 ProxyElement.update (package:flutter/src/widgets/framework.dart:5628:5)

139 Element.updateChild (package:flutter/src/widgets/framework.dart:3685:15)

140 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:5322:16)

141 StatefulElement.performRebuild (package:flutter/src/widgets/framework.dart:5462:11)

142 Element.rebuild (package:flutter/src/widgets/framework.dart:5016:7)

143 StatefulElement.update (package:flutter/src/widgets/framework.dart:5485:5)

144 Element.updateChild (package:flutter/src/widgets/framework.dart:3685:15)

145 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:5322:16)

146 Element.rebuild (package:flutter/src/widgets/framework.dart:5016:7)

147 StatelessElement.update (package:flutter/src/widgets/framework.dart:5373:5)

148 Element.updateChild (package:flutter/src/widgets/framework.dart:3685:15)

149 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:5322:16)

150 Element.rebuild (package:flutter/src/widgets/framework.dart:5016:7)

151 StatelessElement.update (package:flutter/src/widgets/framework.dart:5373:5)

152 Element.updateChild (package:flutter/src/widgets/framework.dart:3685:15)

153 SingleChildRenderObjectElement.update (package:flutter/src/widgets/framework.dart:6441:14)

154 Element.updateChild (package:flutter/src/widgets/framework.dart:3685:15)

155 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:5322:16)

156 Element.rebuild (package:flutter/src/widgets/framework.dart:5016:7)

157 ProxyElement.update (package:flutter/src/widgets/framework.dart:5628:5)

158 Element.updateChild (package:flutter/src/widgets/framework.dart:3685:15)

159 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:5322:16)

160 Element.rebuild (package:flutter/src/widgets/framework.dart:5016:7)

161 ProxyElement.update (package:flutter/src/widgets/framework.dart:5628:5)

162 Element.updateChild (package:flutter/src/widgets/framework.dart:3685:15)

163 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:5322:16)

164 StatefulElement.performRebuild (package:flutter/src/widgets/framework.dart:5462:11)

165 Element.rebuild (package:flutter/src/widgets/framework.dart:5016:7)

166 StatefulElement.update (package:flutter/src/widgets/framework.dart:5485:5)

167 Element.updateChild (package:flutter/src/widgets/framework.dart:3685:15)

168 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:5322:16)

169 StatefulElement.performRebuild (package:flutter/src/widgets/framework.dart:5462:11)

170 Element.rebuild (package:flutter/src/widgets/framework.dart:5016:7)

171 StatefulElement.update (package:flutter/src/widgets/framework.dart:5485:5)

172 Element.updateChild (package:flutter/src/widgets/framework.dart:3685:15)

173 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:5322:16)

174 StatefulElement.performRebuild (package:flutter/src/widgets/framework.dart:5462:11)

175 Element.rebuild (package:flutter/src/widgets/framework.dart:5016:7)

176 BuildOwner.buildScope (package:flutter/src/widgets/framework.dart:2779:19)

177 WidgetsBinding.drawFrame (package:flutter/src/widgets/binding.dart:916:21)

178 RendererBinding._handlePersistentFrameCallback (package:flutter/src/rendering/binding.dart:360:5)

179 SchedulerBinding._invokeFrameCallback (package:flutter/src/scheduler/binding.dart:1297:15)

180 SchedulerBinding.handleDrawFrame (package:flutter/src/scheduler/binding.dart:1227:9)

181 SchedulerBinding._handleDrawFrame (package:flutter/src/scheduler/binding.dart:1085:5)

182 _invoke (dart:ui/hooks.dart:170:13)

183 PlatformDispatcher._drawFrame (dart:ui/platform_dispatcher.dart:401:5)

184 _drawFrame (dart:ui/hooks.dart:140:31)

Image provider: NetworkImage("", scale: 1.0) Image key: NetworkImage("", scale: 1.0)`

Additional Info

No response

Environment

- FlutterFlow version: 4.0
- Platform: Mobile (ios, android)
- Browser name and version: Version 119.0.6045.199 (Official Build) (64-bit)
- Operating system and version affected: Linux Mint 20.1
github-actions[bot] commented 10 months ago

This issue is stale because it has been open for 7 days with no activity. If there are no further updates, a team member will close the issue.

sanchez-gonzalo94 commented 10 months ago

Has this been validated?

github-actions[bot] commented 10 months ago

This issue is stale because it has been open for 7 days with no activity. If there are no further updates, a team member will close the issue.

wemmick commented 10 months ago

I have the same issue. Would be awesome if someone could look into it.

github-actions[bot] commented 10 months ago

This issue is stale because it has been open for 7 days with no activity. If there are no further updates, a team member will close the issue.

aemelyanovff commented 10 months ago

@sanchez-gonzalo94 Thanks for reporting the issue.

I'm afraid we can't guarantee that currentUserDocument is initialized as soon as a user logs in (it usually is, though). As a workaround I can suggest setting a condition like this on your Image widget: Screenshot 2024-01-10 at 4 26 47 PM

Shubham-VE commented 4 months ago

Due to the # in the log(like # 148) added by OP this issue is being mentioned in all places of the logs stack number which is not the intention here.