directory

1.1 Android Release package missing libflutter

1.2 AndroidStudio automatically changes the project into Model without a Flutter directory

1.3 If the input box is empty, the paste toolbar is not displayed

1.4 SWIFT_VERSION '5.0' is unsupported, supported versions are: 3.0, 4.0, 4.2

1.5 Copying and pasting Panel English Problems

Methods marked with @uithread must be executed on the main thread.Current thread: XXXX

1.7 How to pass parameters with navigator.of (context).pushnamed (routeName)

1.8 Listen for widget scroll events in the Body property of NestedScrollView

1.9 Using FutureBuilder The future is rerequested every time setState is called

1.10 cutButtonLabel was called on null on IOS

1.11 Could Not create Dart VM appears after IOS packaging

1.12 Contents in SliverList cannot be located

1.13 After WillPopScope is added, IOS slide return effect is invalid

1.14 error

Not found Occurs on ios

Failed to upload the package \n pub finished with exit code 1 There is a for loop when currentState is fetched, and the page will stall for many times

1.17 During environment establishment, the Android device cannot be connected

1.18 Does not support the minimum OS Version specified in the info.plist

1.19 When using a Provider, when using a Selector, data changes cannot be redrawn automatically

1.1 Android Release package missing libflutter

Modify/android/app/build. Gradle file is as follows

android{
    defaultConfig{
        ndk {
            abiFilters "armeabi-v7a"."x86"
       }
    }
    buildTypes {
          debug {
              ndk {
                abiFilters "armeabi-v7a"."x86"
              }
          }
          release {
              ndk {
                 abiFilters "armeabi-v7a"}}}}Copy the code

1.2 AndroidStudio automatically changes the project into Model without a Flutter directory

Solution: Select file-open – to select your project when importing the project

1.3 If the input box is empty, the paste toolbar is not displayed

Remove the autoFocus attribute from the input box to true

1.4 SWIFT_VERSION '5.0' is unsupported, supported versions are: 3.0, 4.0, 4.2

Open the project as an ios project and find the Pods in the file column (You are advised to upgrade Xcode)

1.5 Copying and pasting Panel English Problems

Add internationalization support to pubspec.yaml and then run flutter Packages Get

dependencies:
  .
  flutter_localizations:
    sdk: flutter
Copy the code

Find the file with the code MaterialApp or CupertinoApp or WidgetsApp and add the following code

        MaterialApp(
/ /...
//new
                localizationsDelegates: const [
                  GlobalMaterialLocalizations.delegate,
                  GlobalWidgetsLocalizations.delegate
                ],
                supportedLocales:[
                  Locale('zh'.' '),
                  Locale('en'.' ')].//new
              )
Copy the code

1.6 Report when calling the libraryMethods marked with @UiThread must be executed on the main thread.Current thread: XXXX

The main reason for this exception is that the thread safety added to Flutter1.7.8 requires native return to Flutter solutions in the main thread:

  • Library problems?

Go to the pub library to find the latest version, change the latest version, and then run flutter Packages Get

  • Write your own library problem?

If:

//Result Result Result of flutter
new Thread(new Runnable() {
      public void run(a) {
/ /...
result.success(null);// This will result in an exception
     }).start();
Copy the code

Instead of

//Result Result Result of flutter
new Thread(new Runnable() {
      public void run(a) {
/ /...
    new Handler().post(new Runnable() {
                @Override
                public void run(a) { result.success(file.getAbsolutePath()); }}); }).start();Copy the code

This is pseudocode and is not recommended as it may cause memory overflow

1.7 withNavigator.of(context).pushNamed(routeName)How to pass parameters

Passing parameters

The Navigator of (context). PushNamed (routeName, the arguments: {" name":"I am a parameter"})Copy the code

To obtain parameters

final arguments=ModalRoute.of(context).settings.arguments;
Copy the code

1.8 listeningNestedScrollViewIn thebodyIn the attributewidgetScroll event

This is done by simply nesting a NotificationListener in the corresponding body

        NestedScrollView(
// controller: scrollController,
          headerSliverBuilder: (BuildContext context, bool innerBoxIsScrolled) {
            return [
              //....
            ];
          },
          body: Builder(
              builder: (BuildContext context) => NotificationListener<ScrollNotification>(
                   onNotification: onNotification,// You want to listen
                   child: CustomScrollView(
                         slivers: <Widget>[
                           //....],),),)Copy the code

1.9 the use ofFutureBuilderPer callsetStateI’m going to ask againfuture

Solution: Extract the Future as a variable

Future<int> future;

  @override
  void initState() {
    super.initState();
    future=getInt();
  }

  FutureBuilder<int>(
    future: future,
    builder: (context, snapshot) {
      return. ; } ), Future<int> getInt(){
    return Future.value(1);

  }
Copy the code

1.10 On IOScutButtonLabel was called on null

Solution: add GlobalCupertinoLocalizations. Delegate

MaterialApp(
/ /...
                localizationsDelegates: [
                  GlobalMaterialLocalizations.delegate,
                  GlobalWidgetsLocalizations.delegate,
//new
                  GlobalCupertinoLocalizations.delegate,
//new 
                ],
                supportedLocales: [
                  const Locale('zh'.'CH'),
                  const Locale('en'.'US'),
                ],
                locale: const Locale('zh'),
/ /...
              )
Copy the code

1.11 Appear after packaging on IOScould not create Dart VM

Dart code does not go into the package because you did not generate the related flutter_assets file

Solution: Run the command before packaging, ignore the generated file and continue with your operation

flutter build ios --release
Copy the code

1.12 SliverListThe contents are unlocatable

Move the content you want to locate out separately

1.13 addWillPopScopeAfter that, the IOS slide-back effect is disabled

Remove the WillPopScope

1.14 aN ios Running Error Occurs<Flutter/Flutter.h> not found

Delete the /ios/ podfile. lock file, go to the ios directory and run pod install again

Appeared when the Flutter plugin was released in 1.15Failed to upload the package \n pub finished with exit code 1

Because you set itPUB_HOSTED_URLAs a result, it was uploaded to other PUB warehouses. Dart’s main warehouse address ishttps://pub.devYou only need to set it to this address

1.17 During environment establishment, the Android device cannot be connected

Can’t find the Tools folder? toOfficial website to download

  • And then I put it inAndroid SDKThe directory
  • Configure the environment variables, and then runsdkmanager --update
  • Find if you can’t findJavaYou need to configureJavaThe environment
  • Run the command again after the command is successfully executedsdkmanager --licensesAnd just keep pressing y
  • After the run is complete, if runflutter doctor -vSee Android Studio is correct, indicating success

1.18 When The package is Uploaded to IOSdoes not support the minimum OS Version specified in the Info.plist.

Modify the project/ios/Flutter/AppFrameworkInfo plist

  <key>MinimumOSVersion</key>
  <string>8.0</string>
Copy the code

Instead of

  <key>MinimumOSVersion</key>
  <string>9.0</string>
Copy the code

1.19 the use ofProviderProcess, useSelectorCannot automatically redraw when data changes

When selecting a Map or List, be careful not to pass the source object

Selector<MyProvider, Map<String.dynamic> > (//watch start
            selector: (BuildContext context, MyProvider provider) =>
                Map.from(provider.map),
//watch end
            shouldRebuild: widget.shouldRebuild,
            builder: (BuildContext context, Map<String.dynamic> value,
                    Widget child) =>
                widget.builder(value),
          )
Copy the code

Feel free to leave your bug questions in the comments, write and fix bugs online