Home > Mobile >  Intro_Slider Error Occured: Try Correcting the name to the name of an existing method, or defining a
Intro_Slider Error Occured: Try Correcting the name to the name of an existing method, or defining a

Time:09-16

I am following a tutorial on how to create an Intro Slider Screen in Flutter in Android Studio using the intro_slider package, and saw a source code online. However, when I try to execute them, it gives me many errors. Please help. The following are the errors that was shown:

Try correcting the name to the name of an existing method, or defining a method named 'FlatButton'. 

      return FlatButton(
                 ^^^^^^^^^^

FAILURE: Build failed with an exception.

* Where:
Script 'C:\src\flutter\packages\flutter_tools\gradle\flutter.gradle' line: 1159

* What went wrong:
Execution failed for task ':app:compileFlutterBuildDebug'.
> Process 'command 'C:\src\flutter\bin\flutter.bat'' finished with non-zero exit value 1

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

ERROR UPDATE:

enter image description here

Here's an example :

TextButton(
            style: TextButton.styleFrom(
              textStyle: const TextStyle(fontSize: 20),
            ),
            onPressed: () {},
            child: const Text('TextButton'),
          ),

UPDATE

Change this from your AndroidManifest.xml: You can find this file from myproject/android/app/src/main/AndroidManifest.xml

<application
    android:icon="@mipmap/ic_launcher"
    android:name="io.flutter.app.FlutterApplication"
    android:label="LabelName"
    ...

To this:

<application
    android:icon="@mipmap/ic_launcher"
    android:name="${applicationName}"
    android:label="LabelName"
    ...

Problems like this can be fixed by upgrading your flutter version or cleaning.

flutter upgrade --force

flutter clean

delete Podfile and Podfile.lock

run pub get

Run your app

  • Related