Removing covariant in the == override #1
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Using covariant in this way disallows us to switch between image providers. This is because DecorationImage and the like use an equals check on their image provider.
As shown in error below, which was thrown when switching between an asset image and the firebase image:
======== Exception caught by widgets library ======================================================= The following _TypeError was thrown building Builder(dirty, dependencies: [Directionality, MediaQuery, _LocalizationsScope-[GlobalKey#61773]]): type 'AssetImage' is not a subtype of type 'FirebaseImageProvider' of 'other'
The relevant error-causing widget was:
Ink Ink:file:///anon/lib/components/widget.dart:100:28
When the exception was thrown, this was the stack:
0 FirebaseImageProvider.== (package:firebase_cached_image/src/firebase_image_provider.dart)
1 DecorationImage.== (package:flutter/src/painting/decoration_image.dart:196:24)
2 BoxDecoration.== (package:flutter/src/painting/box_decoration.dart:329:24)
3 InkDecoration.decoration= (package:flutter/src/material/ink_decoration.dart:355:15)
4 _InkState._build (package:flutter/src/material/ink_decoration.dart:292:13)
5 Builder.build (package:flutter/src/widgets/basic.dart:7448:48)
6 StatelessElement.build (package:flutter/src/widgets/framework.dart:5038:49)
7 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:4968:15)