I try to retrieve the imageLink saved in a Firestore collection of userProfile, but I can't retrieve the data and it displays the following errors. Does anyone know why this happens and how to fix it?
Error
The following _TypeError was thrown building StreamBuilder<DocumentSnapshot<Object?>>(dirty, state:
_StreamBuilderBaseState<DocumentSnapshot<Object?>, AsyncSnapshot<DocumentSnapshot<Object?>>>#dbdf2):
type 'Null' is not a subtype of type 'Map<String, dynamic>' in type cast**
The relevant error-causing widget was:
StreamBuilder<DocumentSnapshot<Object?>>
StreamBuilder:file:///C:/Users/project/lib/views/profile_page.dart:173:34
When the exception was thrown, this was the stack:
#0 _ProfilePageState.build.<anonymous closure>.<anonymous closure> (package:success_auto/views/profile_page.dart:181:39)
profile_page.dart:181
#1 StreamBuilder.build (package:flutter/src/widgets/async.dart:439:81)
async.dart:439
#2 _StreamBuilderBaseState.build (package:flutter/src/widgets/async.dart:120:48)
async.dart:120
#3 StatefulElement.build (package:flutter/src/widgets/framework.dart:5409:27)
framework.dart:5409
#4 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:5297:15)
framework.dart:5297
#5 StatefulElement.performRebuild (package:flutter/src/widgets/framework.dart:5462:11)
framework.dart:5462
#6 Element.rebuild (package:flutter/src/widgets/framework.dart:5016:7)
framework.dart:5016
#7 BuildOwner.buildScope (package:flutter/src/widgets/framework.dart:2779:19)
framework.dart:2779
#8 WidgetsBinding.drawFrame (package:flutter/src/widgets/binding.dart:916:21)
binding.dart:916
#9 RendererBinding._handlePersistentFrameCallback (package:flutter/src/rendering/binding.dart:360:5)
binding.dart:360
#10 SchedulerBinding._invokeFrameCallback (package:flutter/src/scheduler/binding.dart:1297:15)
binding.dart:1297
#11 SchedulerBinding.handleDrawFrame (package:flutter/src/scheduler/binding.dart:1227:9)
binding.dart:1227
#12 SchedulerBinding._handleDrawFrame (package:flutter/src/scheduler/binding.dart:1085:5)
binding.dart:1085
#13 _invoke (dart:ui/hooks.dart:170:13)
hooks.dart:170
#14 PlatformDispatcher._drawFrame (dart:ui/platform_dispatcher.dart:401:5)
platform_dispatcher.dart:401
#15 _drawFrame (dart:ui/hooks.dart:140:31)
hooks.dart:140
[![Firebase Firestore][2]][2]

Make sure that the document with the specified ID exists in the Firestore collection.
Before accessing any field, check if the document exists and the field is not null to avoid the error you mentioned.
And you are using "snapshot" identifier for collection("Users") and collection("userProfile").Try to use different identifiers and try again.