[google_maps_flutter] Android Code Inspection and Clean up#3112
[google_maps_flutter] Android Code Inspection and Clean up#3112hamdikahloun merged 17 commits intoflutter:masterfrom hamdikahloun:google_maps_flutter
Conversation
| import com.google.android.gms.maps.model.LatLngBounds; | ||
| import io.flutter.plugin.common.BinaryMessenger; | ||
| import io.flutter.plugin.common.PluginRegistry; | ||
| import io.flutter.plugin.common.*; |
There was a problem hiding this comment.
Please use specific imports, avoid *
| import io.flutter.plugin.common.MethodCall; | ||
| import io.flutter.plugin.common.MethodChannel; | ||
| import io.flutter.plugin.common.PluginRegistry; | ||
| import io.flutter.plugin.common.*; |
There was a problem hiding this comment.
i have this warning if i just import PluginRegistry :
warning: [deprecation] PluginRegistry in io.flutter.plugin.common has been deprecated
import io.flutter.plugin.common.PluginRegistry;
There was a problem hiding this comment.
@dnfield i fixed using io.flutter.plugin.common.PluginRegistry.Registrar
There was a problem hiding this comment.
Correct, you can't import deprecated classes. You have to use it by the fully qualified name and add the lint ignore statement on the same line.
| Application application, | ||
| Lifecycle lifecycle, | ||
| PluginRegistry.Registrar registrar, | ||
| @SuppressWarnings("deprecation") io.flutter.plugin.common.PluginRegistry.Registrar registrar, |
xster
left a comment
There was a problem hiding this comment.
The API dedeprecation usage LGTM
| if (data.size() == 2) { | ||
| return BitmapDescriptorFactory.fromAsset( | ||
| FlutterMain.getLookupKeyForAsset(toString(data.get(1)))); | ||
| FlutterInjector.instance() |
There was a problem hiding this comment.
nit, just keep a local reference to the flutter loader to keep it shorter
| class Convert { | ||
|
|
||
| private static BitmapDescriptor toBitmapDescriptor(Object o) { | ||
| final FlutterLoader flutterLoader = FlutterInjector.instance().flutterLoader(); |
There was a problem hiding this comment.
This probably isn't present on stable, or if it is, we have to increase the minimum version Flutter SDK constraint most likelyt o capture it. /cc @xster
There was a problem hiding this comment.
We should also consider whether we just ignore a depprecation warning for this or not - xster will have more context there.
There was a problem hiding this comment.
phew, glad you caught me. Forgot about targeting stable. We should indeed leave an ignore like https://github.com/flutter/plugins/pull/3072/files#diff-e57a1a7ffb729ad174b597626202429c1c87e4168e19b2aa9decc1be84e8777bR56 with a TODO to remove when the next stable ships. For now we have to use the old APIs.
dnfield
left a comment
There was a problem hiding this comment.
Need to figure out the Flutter SDK constraint or used deprecated API
| class Convert { | ||
|
|
||
| private static BitmapDescriptor toBitmapDescriptor(Object o) { | ||
| final FlutterLoader flutterLoader = FlutterInjector.instance().flutterLoader(); |
There was a problem hiding this comment.
We should also consider whether we just ignore a depprecation warning for this or not - xster will have more context there.
dnfield
left a comment
There was a problem hiding this comment.
LGTM modulo filing an issue for the TODO
| class Convert { | ||
|
|
||
| // TODO(hamdikahloun): FlutterMain has been deprecated and should be replaced with FlutterLoader | ||
| // when it's available in Stable channel. |
There was a problem hiding this comment.
Please file an issue if there isn't one already and link it here.
) * Android Code Inspection and Clean up * Android Code Inspection and Clean up * Android Code Inspection and Clean up * Android Code Inspection and Clean up * Android Code Inspection and Clean up * Android Code Inspection and Clean up * Import PluginRegistry * Import PluginRegistry * Update GoogleMapController.java * google_maps_flutter * Update build.gradle * Update Convert.java * Update Convert.java Add TODO comment * Update Convert.java
) * Android Code Inspection and Clean up * Android Code Inspection and Clean up * Android Code Inspection and Clean up * Android Code Inspection and Clean up * Android Code Inspection and Clean up * Android Code Inspection and Clean up * Import PluginRegistry * Import PluginRegistry * Update GoogleMapController.java * google_maps_flutter * Update build.gradle * Update Convert.java * Update Convert.java Add TODO comment * Update Convert.java
Description
Handle deprecation & unchecked warning as error
Avoiding uses or overrides a deprecated API
Related Issues
flutter/flutter#65970
Checklist
Before you create this PR confirm that it meets all requirements listed below by checking the relevant checkboxes (
[x]). This will ensure a smooth and quick review process.///).flutter analyze) does not report any problems on my PR.Breaking Change
Does your PR require plugin users to manually update their apps to accommodate your change?