error: the method ´flatbutton´ isn´t defined for the class - android

recently I realized that there was a flutter update, I am trying to debug an app that I have tested before, right now the console throws me the following errors:
here is a screenshot of my error
error: the method ´flatbutton´ isn´t defined for the class
I am a newbie in flutter please if someone could help I would appreciate it

FlatButton was deprecated and in the new Flutter version you should use TextButton or OutlinedButton to replace it

A new set of basic material button widgets and themes have been added to Flutter. The original classes have been deprecated and will eventually be removed. The overall goal is to make buttons more flexible, and easier to configure via constructor parameters or themes.
See docs for more info and the New Widgets to use.

Related

Flutter constructor error on android studio. It keeps showing error

enter image description here
When I try to create a new class in the library of flutter, inside the class the constructor shows error
The problem is that you have your parameters as optionally named, which means the caller can decide not to pass q or a, but you also marked them as non-nullable. Add the required keyword before your parameters to make sure they're passed in and are non-null, or add a default.
Also, in the future:
Please copy-paste your code instead of using an image. This lets us quickly copy-paste it into our IDEs and find any errors.
Please post the error you're getting. Errors are your friends, they tell you what's wrong, and they'll help us figure out how to help you.

Unable to implement Knox' EnterpiseDeviceManager

I am trying to implement the EnterpriseDeviceManager class of the Knox Standard SDK using the given example in the documentation: Documentation
However i am getting the following error:Error
My app has the MDM_RESTRICTION permission and I am within a class deriving from Activity.
Is there any known issue?
Apparently it has no effect whatsoever and is just an obnoxious error.
I was able to use the class nontheless.
You're correct that this is a common error shown when attempting to use this code. If you add the following warning suppression line, then the error underline will go away:
#SuppressLint("WrongConstant")
EnterpriseDeviceManager edm = (EnterpriseDeviceManager) getSystemService(EnterpriseDeviceManager.ENTERPRISE_POLICY_SERVICE);

Android Studio not recognizing Espresso/Hamcrest static method names without prefacing with the classname

I wasn't sure exactly what headline to give this question because I'm not sure what this is technically called. In Android Studio while typing out Espresso tests I noticed that it refuses to accept something like this:
onView(withId(R.id.someId)).perform(click());
and instead will only accept this:
Espresso.onView(ViewMatchers.withId(R.id.someId)).perform(ViewActions.click());
even though every example that I've seen online shows the first example as correct code. Why is Android Studio forcing me to preface every ViewMatcher/Espresso/ViewActions/etc. method with the classname even after the imports are included in my class?
To clarify - trying to use the first example shows "cannot resolve method" and using autocomplete on it (which I have to do several times before it will work) invariably autocompletes to the second example. In all the "regular" code for my project autocomplete works correctly and short method names are recognized. I've tried doing a "clean" and "invalidate cache and restart" but no change.
Example of Google doc that shows usage according to the shortened code:
https://developer.android.com/training/testing/ui-testing/espresso-testing.html
You can try to check out your Android Studio Preferences for imports. Just go to Preferences -> Search "imports"
Here are the settings that I use and I don't have that issue:
What fixed the issue for me: just removed red withId in one place. Then just re-entered "withId": after that all the other red withId were replaced with black text color withId and now it compiled successfull!

Android Lint Plugin - set custom warning / error that should be checked

My question is if there is a way to add to lint plugin a custom check which it should warn me about before building a version. For example I want it to check all Cursor, InputStream objects in my code if they are closed, or to check my code for //TODO:, //FIXME:.
Any ideas if there is any kind of way to do that, or even not with Lint Plugin?
Thanks in advance!
Yes, you can add custom checks; see http://tools.android.com/tips/lint/writing-a-lint-check and http://tools.android.com/tips/lint-custom-rules .
For your specific question, note that there's a new lint check in 21.1 which looks at comments. It doesn't look for TODO or FIXME; instead, it complains if it finds the comment marker "STOPSHIP". If you want to add a rule for todo or fixme, you might want to base it on that check.

Unable to find components using the findViewById method in Android

I'm attempting to create an Activity and unfortunately every time I want to grab one of my XML components it gives me a RunTimeException (NullPointer).
Anytime I use code such as:
TextView tv = (TextView) findViewById(R.id.myView); //I get the exception
The same happens for any components I attempt to find with that method. I can't quite figure out why. I know it isn't due to the Activity not being in the Manifest because it's the only Activity in the test app I made. (The one set up by default).
Oddly I can still use setContentView(R.id.myView). It just doesn't seem to want to find anything when using the findViewById method.
Info that might be of use:
I am currently using NetBeans as my IDE.
I have done multiple 'clean and builds' as was suggested in another question. Android -findViewById question
Has anyone run into this issue before? If so, what was the solution?
If need be, I can provide sample code of when this is happening.
Don't pass in a view ID to setContentView, pass in a layout resource ID:
setContentView(R.layout.layout_name);
If you still have problems, post your layout file.
It is very sure that you R.java is not properly generated.
Delete R.Java in netbeans IDE and Re-build the project.
Hope it resolves your query.

Categories

Resources