flutter : NoSuchMethodError: The method 'startsWith' was called on null.
Using the latest master (fe9795068959db99918cd4196d8c2c420786a0a2), I cannot display any image in the single image view. The image view stays empty and the following is logged:
09-28 20:28:11.939 15560 15660 I flutter : NoSuchMethodError: The method 'startsWith' was called on null.
09-28 20:28:11.939 15560 15660 I flutter : Receiver: null
09-28 20:28:11.939 15560 15660 I flutter : Tried calling: startsWith()
09-28 20:28:11.952 15560 15660 I flutter : #0 _ImageViewPageState.build.<anonymous closure> (package:piwigo_ng/views/ImageViewPage.dart:305)
09-28 20:28:11.952 15560 15660 I flutter : #1 SliverChildBuilderDelegate.build (package:flutter/src/widgets/sliver.dart:456)
09-28 20:28:11.952 15560 15660 I flutter : #2 SliverMultiBoxAdaptorElement._build (package:flutter/src/widgets/sliver.dart:1214)
09-28 20:28:11.952 15560 15660 I flutter : #3 SliverMultiBoxAdaptorElement.createChild.<anonymous closure> (package:flutter/src/widgets/sliver.dart:1227)
09-28 20:28:11.952 15560 15660 I flutter : #4 BuildOwner.buildScope (package:flutter/src/widgets/framework.dart:2531)
09-28 20:28:11.952 15560 15660 I flutter : #5 SliverMultiBoxAdaptorElement.createChild (package:flutter/src/widgets/sliver.dart:1220)
09-28 20:28:11.952 15560 15660 I flutter : #6 RenderSliverMultiBoxAdaptor._createOrObtainChild.<anonymous closure> (package:flutter/src/rendering/sliver_multi_box_adaptor.dart:349)
09-28 20:28:11.952 15560 15660 I flutter : #7 RenderObject.invokeLayoutCallback.<anonymous closure> (package:flutter/src/rendering/object.dart:1965)
09-28 20:28:11.952 15560 15660 I flutter : #8 BuildOwner.lockState (package:flutter/src/widgets/framework.dart:2468)
09-28 20:28:11.952 15560 15660 I flutter : #9 RenderObject.invokeLayoutCallback (package:flutter/src/rendering/object.dart:1965)
09-28 20:28:11.952 15560 15660 I flutter : #10 RenderSliverMultiBoxAdaptor._createOrObtainChild (package:flutter/src/rendering/sliver_multi_box_adaptor.dart:338)
09-28 20:28:11.952 15560 15660 I flutter : #11 RenderSliverMultiBoxAdaptor.addInitialChild (package:flutter/src/rendering/sliver_multi_box_adaptor.dart:422)
09-28 20:28:11.952 15560 15660 I flutter : #12 RenderSliverFixedExtentBoxAdaptor.performLayout (package:flutter/src/rendering/sliver_fixed_extent_list.dart:205)
09-28 20:28:11.952 15560 15660 I flutter : #13 RenderObject.layout (package:flutter/src/rendering/object.dart:1855)
09-28 20:28:11.952 15560 15660 I flutter : #14 RenderSliverEdgeInsetsPadding.performLayout (package:flutter/src/rendering/sliver_padding.dart:137)
09-28 20:28:11.952 15560 15660 I flutter : #15 _RenderSliverFractionalPadding.performLayout (package:flutter/src/widgets/sliver_fill.dart:167)
09-28 20:28:11.952 15560 15660 I flutter : #16 RenderObject.layout (package:flutter/src/rendering/object.dart:1855)
09-28 20:28:11.952 15560 15660 I flutter : #17 RenderViewportBase.layoutChildSequence (package:flutter/src/rendering/viewport.dart:510)
09-28 20:28:11.952 15560 15660 I flutter : #18 RenderViewport._attemptLayout (package:flutter/src/rendering/viewport.dart:1580)
09-28 20:28:11.952 15560 15660 I flutter : #19 RenderViewport.performLayout (package:flutter/src/rendering/viewport.dart:1489)
09-28 20:28:11.952 15560 15660 I flutter : #20 RenderObject.layout (package:flutter/src/rendering/object.dart:1855)
I inserted a couple of debug statements, image is:
{id: 17296, width: 768, height: 1024, hit: 4, file: IMG-20220823-WA0175.jpg, name: IMG-20220823-WA0175, comment: null, date_creation: null, date_available: 2022-08-23 21:24:04, page_url: https://<redacted>/picture.php?/17296, element_url: https://<redacted>/action.php?id=17296&part=e, derivatives: {square: {url: https://<redacted>/i.php?/upload/2022/08/23/20220823212404-4376b192-sq.jpg, width: 120, height: 120}, thumb: {url: https://<redacted>/i.php?/upload/2022/08/23/20220823212404-4376b192-th.jpg, width: 108, height: 144}, 2small: {url: https://<redacted>/i.php?/upload/2022/08/23/20220823212404-4376b192-2s.jpg, width: 180, height: 240}, xsmall: {url: https://<redacted>/i.php?/upload/2022/08/23/20220823212404-4376b192-xs.jpg, width: 243, height: 324}, small: {url: https://<redacted>/i.php?/upload/2022/08/23/20220823212404-4376b192-sm.jpg, width: 324, height: 432}, medium:
According to https://pub.dev/packages/mime_type, "mime" may return null.
Hmm, thanks for your workarounds, I'll check that monday.
You are right, the "element_url" format may not be supported by mime_type plugin.
I can add a check if mime_type returns null, but that means it will show as an image by default. Or, your file is not an image, I will show a File icon.
The null check would definitely make sense to avoid the exception, also on future code changes.
As for the format detection, would it make sense to run mime against "file" instead of "element_url"?
- [ ] Run mime against "file" instead of "element_url"?
This has the "probably fixed" label, but still occurs with the latest master. Is this intentional?
Strange, I added a handler on mime_type returns null.
Could you please tell me the commit hash of your fix? I don't see anything related in the commit history.
I think I accidentally rolled back the changes made for that issue, sorry for the inconvenience. It will be fixed for the next release (1.2.1).
Thank you very much. I've waited release to release for almost 1 year because my thumbnails were loading and the pictures (in large view) themselves did not load (blank display). This is finally working in 1.2.1 👍 . Good work!
There is still an improvement:
- [ ] when url mimeType is null, check file name mimeType instead.
My only problem left now is: the videos also stay "blank/grey" when I click on them to play. Is this related to those mime type problems? They are encoded h264, e.g. compatible with exoplayer.
If the mime type returns null (cannot be defined) it will try to show an image (thumbnail).
How can I diagnose this further regarding the non-playable videos?