flutter_instagram_stories icon indicating copy to clipboard operation
flutter_instagram_stories copied to clipboard

_CastError (type '_InternalLinkedHashMap<String, dynamic>' is not a subtype of type 'List<dynamic>?' in type cast)

Open Cengizhan00 opened this issue 2 years ago • 7 comments

Stories _$StoriesFromJson(Map<String, dynamic> json) { return Stories( storyId: json['storyId'] as String?, date: json['date'] == null ? null : DateTime.parse(json['date'] as String), file: (json['file'] as List<dynamic>?)?.map((e) => StoryData.fromJson(e as Map<String, dynamic>)).toList(), previewImage: json['previewImage'] as String?, previewTitle: (json['previewTitle'] as Map<String, dynamic>?)?.map( (k, e) => MapEntry(k, e as String), ), ); }

Cengizhan00 avatar Jun 24 '22 21:06 Cengizhan00

@awaik

Cengizhan00 avatar Jun 24 '22 21:06 Cengizhan00

I solved the above problem, this time it gives this error

_TypeError (type '() => Null' is not a subtype of type '(() => StoryItem)?' of 'orElse')

Cengizhan00 avatar Jun 24 '22 22:06 Cengizhan00

@awaik this issue is still persesting _TypeError (type '() => Null' is not a subtype of type '(() => StoryItem)?' of 'orElse')

shukill avatar Jul 07 '22 15:07 shukill

Can you please provide full error log?

awaik avatar Jul 08 '22 06:07 awaik

`[GETX] OPEN BOTTOMSHEET 71736793 [GETX] GOING TO ROUTE /StoriesSection

════════ Exception caught by widgets library ═══════════════════════════════════ The following _TypeError was thrown building RawGestureDetector(state: RawGestureDetectorState#6fcd5(gestures: [vertical drag])): type '() => Null' is not a subtype of type '(() => StoryItem)?' of 'orElse'

The relevant error-causing widget was GetMaterialApp lib/main.dart:44 When the exception was thrown, this was the stack #0 ListMixin.firstWhere (dart:collection/list.dart) #1 StoryViewState.initState package:flutter_instagram_stories/story_view.dart:322 #2 StatefulElement._firstBuild package:flutter/…/widgets/framework.dart:4942 #3 ComponentElement.mount package:flutter/…/widgets/framework.dart:4781 ... Normal element mounting (32 frames) #35 Element.inflateWidget package:flutter/…/widgets/framework.dart:3817 #36 MultiChildRenderObjectElement.inflateWidget package:flutter/…/widgets/framework.dart:6350 #37 MultiChildRenderObjectElement.mount package:flutter/…/widgets/framework.dart:6362 ... Normal element mounting (29 frames) #66 Element.inflateWidget package:flutter/…/widgets/framework.dart:3817 #67 Element.updateChild package:flutter/…/widgets/framework.dart:3545 #68 ComponentElement.performRebuild package:flutter/…/widgets/framework.dart:4832 #69 StatefulElement.performRebuild package:flutter/…/widgets/framework.dart:4977 #70 Element.rebuild package:flutter/…/widgets/framework.dart:4529 #71 BuildOwner.buildScope package:flutter/…/widgets/framework.dart:2659 #72 WidgetsBinding.drawFrame package:flutter/…/widgets/binding.dart:891 #73 RendererBinding._handlePersistentFrameCallback package:flutter/…/rendering/binding.dart:370 #74 SchedulerBinding._invokeFrameCallback package:flutter/…/scheduler/binding.dart:1146 #75 SchedulerBinding.handleDrawFrame package:flutter/…/scheduler/binding.dart:1083 #76 SchedulerBinding._handleDrawFrame package:flutter/…/scheduler/binding.dart:997 #80 _invoke (dart:ui/hooks.dart:151:10) #81 PlatformDispatcher._drawFrame (dart:ui/platform_dispatcher.dart:308:5) #82 _drawFrame (dart:ui/hooks.dart:115:31) Screenshot 2022-07-08 at 12 40 04 PM

(elided 3 frames from dart:async) ════════════════════════════════════════════════════════════════════════════════`

@awaik

shukill avatar Jul 08 '22 07:07 shukill

am having same issue. I have done automatically, that is by generating the data class by vs code pluggin.

Akperhe avatar Oct 03 '22 23:10 Akperhe

Hi, Somehow, I couldn't repeat it with an example project. If you have open-source repo - can you please give me a link to it and I'll try to catch this bug.

awaik avatar Oct 18 '22 07:10 awaik