Reputation: 8013
I am testing platform specific coding with Flutter. I opened the android folder in Android Studio, wrote my code and it shows no errors. I then moved back to Flutter which is underlining in red the Rs in the code below. However, the app is working fine. I am wondering why an error is showing and what I can do to remove these red lines. I would be grateful for pointers.
Here is my code:
public class MyTileService extends TileService {
private final int STATE_ON = 1;
private final int STATE_OFF = 0;
private int toggleState = STATE_ON;
@Override
public void onTileAdded() {
System.out.println("onTileAdded");
}
@Override
public void onTileRemoved() {
System.out.println("onTileRemoved");
}
@Override
public void onStartListening() {
System.out.println("onStartListening");
}
@Override
public void onStopListening() {
System.out.println("onStopListening");
}
@Override
public void onClick() {
System.out.println("onClick state = " + Integer.toString(getQsTile().getState()));
Icon icon;
if (toggleState == STATE_ON) {
toggleState = STATE_OFF;
icon = Icon.createWithResource(getApplicationContext(), R.drawable.ic_spa_black_24dp);
System.out.println("OFF");
} else {
toggleState = STATE_ON;
icon = Icon.createWithResource(getApplicationContext(), R.drawable.ic_star_border_black_24dp);
System.out.println("ON");
}
getQsTile().setIcon(icon);
getQsTile().updateTile();
}
}
I tried cleaning the android project, uninstalling and reinstalling Flutter and Dart plugins, checking flutter doctor.
Here is an image:
Upvotes: 4
Views: 2900
Reputation: 15012
Flutter projects are not Gradle-based Android projects so a number of features provided by Android Studio are not available to Flutter programmers.
This still is a Flutter Plugin.
Is documented here:
And you can track it here:
It seems that the first item is check, so it's only a metter of time to wait this milestone to be released.
Upvotes: 7