This repository was archived by the owner on Feb 22, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 9.7k
[Image_Picker] Use cache instance on Android #1877
Merged
cyanglaz
merged 8 commits into
flutter:master
from
juliocbcotta:plugin/image_pick_use_cache_instance
Jul 29, 2019
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
e62447d
migrated cache implementation from static method to use instance methods
juliocbcotta 5b2ff58
format code
juliocbcotta f965d14
updated CHANGELOG.md and pubspec.yaml
juliocbcotta 6329b62
removed unused method
juliocbcotta c170614
Merge remote-tracking branch 'flutter/master' into plugin/image_pick_…
juliocbcotta 717f677
fix build version
juliocbcotta 9de1394
Merge remote-tracking branch 'flutter/master' into plugin/image_pick_…
juliocbcotta a7a289f
Merge branch 'master' into plugin/image_pick_use_cache_instance
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -6,7 +6,7 @@ authors: | |
| - Rhodes Davis Jr. <[email protected]> | ||
| homepage: https://github.com/flutter/plugins/tree/master/packages/image_picker | ||
|
|
||
| version: 0.6.0+19 | ||
| version: 0.6.0+20 | ||
|
|
||
| flutter: | ||
| plugin: | ||
|
|
||
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see all the null check are removed. I am not a Java expert but how do we ensure the
prefsis not null to prevent NPE?Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.
staticmethods and variables are associated with the class they are declared.Non static methods and variables are associated with an instance of an object of a given type.
I removed
staticdeclaration forprefsto make it part of an instance ofImagePickerCache. To accessprefs, I need an instance ofImagePickerCache.So we know
prefsis never null because it is being instantiated in the constructor ofImagePickerCache.As
prefsis no longerstatic, thestaticmethods were converted to instance methods as well. Static methods can't access non static variables/methods after all.As a rule of thumb: Avoid static methods/variables. They are hard to write unit tests and they are memory leak and error prone.