Flutter 开发错误集合

HandshakeException: Handshake error in client (OS Error: WRONG_VERSION_NUMBER(tls_record.cc:242)) 

因为使用Dio网络框架进行数据请求时采用的http请求,保证了手机连接的网络和电脑连接的网络IP是同一个

解决方案:

Dio 请求的 BaseUrl 
var url = Uri.https('xx.x.x.x:端口号', '请求地址后面部分')

例如 :

var url = Uri.https('192.168.xx.xx:8080', '/')

Launching lib/main.dart on KOZ AL00 in debug mode...
Running Gradle task 'assembleDebug'...   一直进行中 

 

修改 build.gradle 文件

maven {
            allowInsecureProtocol = true
            url 'https://maven.aliyun.com/repository/google'
        }
        maven {
            allowInsecureProtocol = true
            url 'https://maven.aliyun.com/repository/jcenter'
        }
        maven {
            allowInsecureProtocol = true
            url 'http://maven.aliyun.com/nexus/content/groups/public'
        }

minSdkVersion 16 cannot be smaller than version 19  

        Suggestion: use a compatible library with a minSdk of at most 16,
                or increase this project's minSdk version to at least 19,
                or use tools:overrideLibrary="com.leeson.image_pickers" to force usage (may lead to runtime failures)

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:processDebugMainManifest'.
> Manifest merger failed : uses-sdk:minSdkVersion 16 cannot be smaller than version 19 declared in library 

解决方案

修改minSdkVerison版本

Flutter Incorrect use of ParentDataWidget 

原因 

Expanded、Flexible等组件 , 在“Container、Padding、Stack”组件中导致的

Expanded、Flexible只在Row、Column等组件内,不在其他组件内使用。

修改后

TextField/Rect argument contained a NaN value. 'dart:ui/painting.dart':

The following assertion was thrown during paint():
Rect argument contained a NaN value.
'dart:ui/painting.dart':
Failed assertion: line 40 pos 10: '<optimized out>'


Either the assertion indicates an error in the framework itself, or we should provide substantially more information in this error message to help you determine and fix the underlying cause.
In either case, please report this assertion by filing a bug on GitHub:
  https://github.com/flutter/flutter/issues/new?template=2_bug.md

When the exception was thrown, this was the stack: 
#2      _rectIsValid (dart:ui/painting.dart:40:10)
#3      Canvas.drawRect (dart:ui/painting.dart:4354:12)
#4      _FloatingCursorPainter.paintRegularCursor (package:flutter/src/rendering/editable.dart:2701:16)
#5      _FloatingCursorPainter.paint (package:flutter/src/rendering/editable.dart:2732:7)
#6      _CompositeRenderEditablePainter.paint (package:flutter/src/rendering/editable.dart:2784:15)
#7      _RenderEditableCustomPaint.paint (package:flutter/src/rendering/editable.dart:2434:15)
#8      RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:2403:7)
#9      PaintingContext._repaintCompositedChild (package:flutter/src/rendering/object.dart:141:11)
#10     PaintingContext.repaintCompositedChild (package:flutter/src/rendering/object.dart:100:5)
#11     PipelineOwner.flushPaint (package:flutter/src/rendering/object.dart:973:29)
#12     RendererBinding.drawFrame (package:flutter/src/rendering/binding.dart:499:19)
#13     WidgetsBinding.drawFrame (package:flutter/src/widgets/binding.dart:883:13)
#14     RendererBinding._handlePersistentFrameCallback (package:flutter/src/rendering/binding.dart:363:5)
#15     SchedulerBinding._invokeFrameCallback (package:flutter/src/scheduler/binding.dart:1145:15)
#16     SchedulerBinding.handleDrawFrame (package:flutter/src/scheduler/binding.dart:1082:9)
#17     SchedulerBinding._handleDrawFrame (package:flutter/src/scheduler/binding.dart:996:5)
#21     _invoke (dart:ui/hooks.dart:150:10)
#22     PlatformDispatcher._drawFrame (dart:ui/platform_dispatcher.dart:270:5)
#23     _drawFrame (dart:ui/hooks.dart:114:31)
(elided 5 frames from class _AssertionError and dart:async)
The following RenderObject was being processed when the exception was fired: _RenderEditableCustomPaint#9a2f0
...  needs compositing
...  parentData: offset=Offset(0.0, 0.0); offset=Offset(0.0, 0.0)
...  constraints: BoxConstraints(w=292.0, h=1.0)
...  layer: OffsetLayer#55d58
...    engine layer: OffsetEngineLayer#4eb7b
...    handles: 2
...    offset: Offset(0.0, 0.0)
...  size: Size(292.0, 1.0)
RenderObject: _RenderEditableCustomPaint#9a2f0
  needs compositing
  parentData: offset=Offset(0.0, 0.0); offset=Offset(0.0, 0.0)
  constraints: BoxConstraints(w=292.0, h=1.0)
  layer: OffsetLayer#55d58
    engine layer: OffsetEngineLayer#4eb7b
    handles: 2
    offset: Offset(0.0, 0.0)
  size: Size(292.0, 1.0)

解决方案

发现没有设置编辑框的字体大小 , 设置fontSize 大于 0.0

Please remove the file from history and try again 

执行git push (向仓库推送代码) 时报错如下 :  

git: 'credential-wincred' is not a git command. See 'git --help'.
Enumerating objects: 235, done.
Counting objects: 100% (235/235), done.
Delta compression using up to 4 threads
Compressing objects: 100% (191/191), done.
Writing objects: 100% (234/234), 217.68 MiB | 9.88 MiB/s, done.
Total 234 (delta 30), reused 0 (delta 0), pack-reused 0
remote: Resolving deltas: 100% (30/30), done.
remote: Powered by GITEE.COM [GNK-6.2]
remote: error: File: c7cef8e5daa50e92ddd2a0d4758759dfbfd98eb8 196.64 MB, exceeds 100.00 MB.
remote: Use command below to see the filename:
remote: git rev-list --objects --all | grep c7cef8e5daa50e92ddd2a0d4758759dfbfd98eb8
remote: Please remove the file from history and try again.

解决方案

执行清理缓存

git gc --prune=now

根据错误提示执行命令 / 查看要占有内存过大的文件 / 进行删除

git rev-list --objects --all | 
grep c7cef8e5daa50e92ddd2a0d4758759dfbfd98eb8

占用内存过大的路径是

再次执行命令进行删除

git filter-branch --tree-filter 'rm -f 文件名' HEAD  

 最后执行命令

git push

background_fetch Received status code 502 from server: Bad Gateway 

FAILURE: Build failed with an exception.                                  
                                                                          
* What went wrong:                                                        
Could not determine the dependencies of task ':app:processDebugResources'.
> Could not resolve all task dependencies for configuration ':app:debugRuntimeClasspath'.
   > Could not resolve com.transistorsoft:tsbackgroundfetch:+.
     Required by:
         project :app > project :background_fetch
      > Failed to list versions for com.transistorsoft:tsbackgroundfetch.
         > Unable to load Maven meta-data from https://google.bintray.com/exoplayer/com/transistorsoft/tsbackgroundfetch/maven-metadata.xml.
            > Could not get resource 'https://google.bintray.com/exoplayer/com/transistorsoft/tsbackgroundfetch/maven-metadata.xml'.
               > Could not GET 'https://google.bintray.com/exoplayer/com/transistorsoft/tsbackgroundfetch/maven-metadata.xml'. Received status code 502 from server: Bad Gateway

* 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.

解决方案

更新 Android Studio 版本 / 修改build.gradle配置 / 修改gradle版本号 / 开发工具要和gradle配置一一对应

  ​​​​​​

 Android Gradle plugin requires Java 11 to run. You are currently using Java 1.8.

An exception occurred applying plugin request [id: 'com.android.application']
> Failed to apply plugin 'com.android.internal.application'.
   > Android Gradle plugin requires Java 11 to run. You are currently using Java 1.8.
     You can try some of the following options:
       - changing the IDE settings.
       - changing the JAVA_HOME environment variable.
       - changing `org.gradle.java.home` in `gradle.properties`.

解决方案

No toolchains found in the NDK toolchains folder for ABI with prefix: arm-linux-androideabi 

解决方案 (Android Studio build.gradle)

Gradle download:kotlin-compiler-embeddable 一直下载中

 解决方案

打开 maven 进行搜索 kotlin-compiler

 我这里是下载版本1.5.21

 

找到电脑磁盘里面的 .gradle 文件打开 

删除下面标识的文件夹里面的文件 , 替换成下载的jar包

再重新打开AndroidStudio同步一下即可

The binary version of its metadata is 1.5.1, expected version is 1.1.15

解决方案

修改 kotlin_version 版本号 / 旧版本号(1.3.50) 变成新版本号 (1.4.32)

注意 : koltin_version 版本号要和 gradle 版本号对应

Your flutter checkout has local changes that would be erased by upgrading. If you want to keep these changes, it is recommended that you stash them via "git stash" or else
commit the changes to a local branch. If it is okay to remove local changes, then re-run this command with --force. 

 解决方案  执行命令

flutter upgrade --force

运行命令 查看安装完成后的 flutter sdk 版本

flutter --version

Unspported class file major version 61

表示还不支持Java17

解决方案 

尝试降低JDK版本号 (使用Java16 或者 Java 11 或者 Java8

使用命令查看电脑安装的JDK版本

/usr/libexec/java_home -V

如果本地不存在比Java17版本低的JDK , 参考Flutter环境变量配置下载JDK

gradle.properties 配置 低于JDK 17 的 JDK 的路径

sendReq failed for wechat app signature check
fluwx 插件 微信分享 , 红米手机系统版本为11 提示 微信未安装 

 

 解决方案 : 

在应用的AndroidManifest.xml添加如下<queries>标签 , 指定微信包名 

NDK matched the requested version

No version of NDK matched the requested version 21.0.6113669. Versions available locally: 22.1.7171670, 23.1.7779620

解决方案

ndkVersion '23.1.7779620'

fluttercontactpicker: ^2.0.0 通讯录插件使用异常
 android Attempt to invoke virtual method 'android.content.ContentResolver android.content.Context.getContentResolver()' on a null object reference

 解决方案:

Flutter SDK 版本更新到最新

如果用命令更新失败,那么可以直接下载sdk压缩包进行解压后替换以前原有的sdk.

io.flutter.embedding.engine.FlutterEngine@7bd534e

W/FlutterEnginePluginRegistry( 4322): Attempted to register plugin (io.flutter.embedding.engine.plugins.shim.ShimPluginRegistry$ShimRegistrarAggregate@d001e49) but it was already registered with this Flutte
rEngine (io.flutter.embedding.engine.FlutterEngine@7bd534e).

大概意思:早注册了FlutterEngine

解决方案:

删除 GeneratedPluginRegistrant.registerWith(flutterEngine);

 Xcode The sandbox is not in sync with the Podfile.lock.

The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.

解决方案:

Android Studio 执行命令flutter build ios

Cannot fit requested classes in a single dex file (# methods: 68807 > 65536)

Running Gradle task 'assembleDebug'...
D8: Cannot fit requested classes in a single dex file (# methods: 68807 > 65536)

com.android.builder.dexing.DexArchiveMergerException: Error while merging dex archives:

The number of method references in a .dex file cannot exceed 64K.
D8: Cannot fit requested classes in a single dex file (# methods: 65671 > 65536)
com.android.builder.dexing.DexArchiveMergerException: Error while merging dex archives: 
The number of method references in a .dex file cannot exceed 64K.       
Learn how to resolve this issue at https://developer.android.com/tools/building/multidex.html
        at com.android.builder.dexing.D8DexArchiveMerger.getExceptionToRethrow(D8DexArchiveMerger.java:132)
        at com.android.builder.dexing.D8DexArchiveMerger.mergeDexArchives(D8DexArchiveMerger.java:119)
        at com.android.build.gradle.internal.transforms.DexMergerTransformCallable.call(DexMergerTransformCallable.java:102)
        at com.android.build.gradle.internal.tasks.DexMergingTaskRunnable.run(DexMergingTask.kt:445)
        at com.android.build.gradle.internal.tasks.Workers$ActionFacade.run(Workers.kt:348)
        at org.gradle.workers.internal.AdapterWorkAction.execute(AdapterWorkAction.java:50)
        at org.gradle.workers.internal.DefaultWorkerServer.execute(DefaultWorkerServer.java:47)
        at org.gradle.workers.internal.NoIsolationWorkerFactory$1$1$1.create(NoIsolationWorkerFactory.java:65)
        at org.gradle.workers.internal.NoIsolationWorkerFactory$1$1$1.create(NoIsolationWorkerFactory.java:61)
        at org.gradle.internal.classloader.ClassLoaderUtils.executeInClassloader(ClassLoaderUtils.java:98)
        at org.gradle.workers.internal.NoIsolationWorkerFactory$1$1.execute(NoIsolationWorkerFactory.java:61)
        at org.gradle.workers.internal.AbstractWorker$1.call(AbstractWorker.java:44)
        at org.gradle.workers.internal.AbstractWorker$1.call(AbstractWorker.java:41)
        at org.gradle.internal.operations.DefaultBuildOperationExecutor$CallableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:416)
        at org.gradle.internal.operations.DefaultBuildOperationExecutor$CallableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:406)
        at org.gradle.internal.operations.DefaultBuildOperationExecutor$1.execute(DefaultBuildOperationExecutor.java:165)
        at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:250)
        at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:158)
        at org.gradle.internal.operations.DefaultBuildOperationExecutor.call(DefaultBuildOperationExecutor.java:102)
        at org.gradle.internal.operations.DelegatingBuildOperationExecutor.call(DelegatingBuildOperationExecutor.java:36)
        at org.gradle.workers.internal.AbstractWorker.executeWrappedInBuildOperation(AbstractWorker.java:41)
        at org.gradle.workers.internal.NoIsolationWorkerFactory$1.execute(NoIsolationWorkerFactory.java:56)
        at org.gradle.workers.internal.DefaultWorkerExecutor$3.call(DefaultWorkerExecutor.java:215)
        at org.gradle.workers.internal.DefaultWorkerExecutor$3.call(DefaultWorkerExecutor.java:210)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)     
        at org.gradle.internal.work.DefaultConditionalExecutionQueue$ExecutionRunner.runExecution(DefaultConditionalExecutionQueue.java:215)
        at org.gradle.internal.work.DefaultConditionalExecutionQueue$ExecutionRunner.runBatch(DefaultConditionalExecutionQueue.java:164)
        at org.gradle.internal.work.DefaultConditionalExecutionQueue$ExecutionRunner.run(DefaultConditionalExecutionQueue.java:131)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)     
        at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:64)
        at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:48)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
        at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:56)
        at java.lang.Thread.run(Thread.java:748)                        
Caused by: com.android.tools.r8.CompilationFailedException: Compilation failed to complete
        at com.android.tools.r8.utils.O.a(:65)                          
        at com.android.tools.r8.D8.run(:11)                             
        at com.android.builder.dexing.D8DexArchiveMerger.mergeDexArchives(D8DexArchiveMerger.java:117)
        ... 34 more                                                     
Caused by: com.android.tools.r8.utils.b: Error: null, Cannot fit requested classes in a single dex file (# methods: 65671 > 65536)
        at com.android.tools.r8.utils.y0.a(:21)                         
        at com.android.tools.r8.dex.K.a(:56)                            
        at com.android.tools.r8.dex.K$h.a(:5)                           
        at com.android.tools.r8.dex.b.b(:15)                            
        at com.android.tools.r8.dex.b.a(:38)                            
        at com.android.tools.r8.D8.d(:87)                               
        at com.android.tools.r8.D8.b(:1)                                
        at com.android.tools.r8.utils.O.a(:30)                          
        ... 36 more                                                     
                                                                        
                                                                        
FAILURE: Build failed with an exception.                                
                                                                        
* What went wrong:                                                      
Execution failed for task ':app:mergeDexDebug'.                         
> A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
   > com.android.builder.dexing.DexArchiveMergerException: Error while merging dex archives: 
     The number of method references in a .dex file cannot exceed 64K.  
     Learn how to resolve this issue at https://developer.android.com/tools/building/multidex.html
                                                                        
* 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

 解决方案:参考

build.gradle下配置修改

defaultConfig {
   ......

   multiDexEnabled true

   ......
}
dependencies {
    ......

    implementation 'com.android.support:multidex:1.0.3'

    ......
}

Attribute provider#androidx.core.content.FileProvider@authorities

Attribute meta-data#android.support.FILE_PROVIDER_PATHS@resource value=(@xml/file_paths) 

 <provider
            android:name="androidx.core.content.FileProvider"
            android:authorities="com.android.demo.fileProvider"
            android:exported="false"
            android:grantUriPermissions="true"
            >
            <meta-data
                android:name="android.support.FILE_PROVIDER_PATHS"
                android:resource="@xml/file_paths" />
        </provider>
 Attribute provider#androidx.core.content.FileProvider@authorities value=(com.android.demo.fileProvider) from AndroidManifest.xml:58:13-64

        is also present at [:flutter_webview_plugin] AndroidManifest.xml:11:13-64 value=(com.android.demo.fileprovider).

        Suggestion: add 'tools:replace="android:authorities"' to <provider> element at AndroidManifest.xml to override.
 Attribute meta-data#android.support.FILE_PROVIDER_PATHS@resource value=(@xml/file_paths) from AndroidManifest.xml:53:17-55

        is also present at [:flutter_webview_plugin] AndroidManifest.xml:17:17-50 value=(@xml/filepaths).

        Suggestion: add 'tools:replace="android:resource"' to <meta-data> element at AndroidManifest.xml to override.

解决方案:

 <provider
            android:name="androidx.core.content.FileProvider"
            android:authorities="com.android.demo.fileProvider"
            android:exported="false"
            tools:replace="android:authorities"
            android:grantUriPermissions="true"
            >
            <meta-data
                android:name="android.support.FILE_PROVIDER_PATHS"
                tools:replace="android:resource"
                android:resource="@xml/file_paths" />
        </provider>

The overflowing RenderFlex has an orientation of Axis.vertical.
e.g. using an Expanded widget 

@override
  Widget build(BuildContext context) {
    ScreenUtil.init(context, width: 750, height: 1624, allowFontScaling: true);
    return Scaffold(
      backgroundColor: scaffoldBackColor(),
    
      body: isSv ? getBaseViewNoSv(context) : getBaseView(context),
    );
  }
I/flutter (26133): The overflowing RenderFlex has an orientation of Axis.vertical.
I/flutter (26133): The edge of the RenderFlex that is overflowing has been marked in the rendering with a yellow and
I/flutter (26133): black striped pattern. This is usually caused by the contents being too big for the RenderFlex.
I/flutter (26133): Consider applying a flex factor (e.g. using an Expanded widget) to force the children of the
I/flutter (26133): RenderFlex to fit within the available space instead of being sized to their natural size.
I/flutter (26133): This is considered an error condition because it indicates that there is content that cannot be
I/flutter (26133): seen. If the content is legitimately bigger than the available space, consider clipping it with a
I/flutter (26133): ClipRect widget before putting it in the flex, or using a scrollable container rather than a Flex,
I/flutter (26133): like a ListView.
I/flutter (26133): The specific RenderFlex in question is: RenderFlex#c0a57 relayoutBoundary=up3 OVERFLOWING:
I/flutter (26133):   needs compositing
I/flutter (26133):   creator: Column ← _PointerListener ← Listener ← _GestureSemantics ← RawGestureDetector ←
I/flutter (26133):     GestureDetector ← _BodyBuilder ← MediaQuery ← LayoutId-[<_ScaffoldSlot.body>] ←
I/flutter (26133):     CustomMultiChildLayout ← AnimatedBuilder ← DefaultTextStyle ← ⋯
I/flutter (26133):   parentData: <none> (can use size)
I/flutter (26133):   constraints: BoxConstraints(0.0<=w<=411.4, 0.0<=h<=441.5)
I/flutter (26133):   size: Size(411.4, 441.5)
I/flutter (26133):   direction: vertical
I/flutter (26133):   mainAxisAlignment: start
I/flutter (26133):   mainAxisSize: max
I/flutter (26133):   crossAxisAlignment: center
I/flutter (26133):   verticalDirection: down
I/flutter (26133): ◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤

 解决方案 : 

resizeToAvoidBottomPadding: false

@override
  Widget build(BuildContext context) {
    ScreenUtil.init(context, width: 750, height: 1624, allowFontScaling: true);
    return Scaffold(
      backgroundColor: scaffoldBackColor(),
      resizeToAvoidBottomPadding: false,
      body: isSv ? getBaseViewNoSv(context) : getBaseView(context),
    );
  }

AnimationControllers should be disposed by calling dispose() on the AnimationController itself. 

class CurWidget extends StatefulWidget {
  @override
  State<StatefulWidget> createState() => CurWidgetState();
}

class CurWidgetState extends State<CurWidget>
    with TickerProviderStateMixin {
  AnimationController controller;
  Animation<double> animation;

  @override
  void initState() {
    // TODO: implement initState
    super.initState();
    controller =
        AnimationController(duration: const Duration(seconds: 4), vsync: this);
    animation = Tween(begin: 0.0, end: 1.0).animate(controller);
    animation.addStatusListener((status) {
      if (status == AnimationStatus.completed) {
        ///评估完成

      }
    });
    controller.forward();
  }

  @override
  Widget build(BuildContext context) {
    return Column(
      children: [
        Padding(
          padding: ViewUtils.mp(20.0, 20.0, 20.0, 20.0),
          child: Image.asset(R.assetsImgIcEvaluateProcessTop),
        ),
        ViewUtils.commTextEll(
            '额度评估中……', 0xff000000, 16.0, FontWeight.normal, TextAlign.center),
        Container(
          padding: ViewUtils.mp(0.0, 20.0, 0.0, 40.0),
          child: RotationTransition(
            //设置动画的旋转中心
            alignment: Alignment.center,
            //动画控制器
            turns: animation,
            //将要执行动画的子view
            child: Image.asset(
              R.assetsImgIcEvaluateProgressAnimation,
              alignment: Alignment.center,
            ),
          ),
        ),
      ],
    );
  }

  @override
  void dispose() {
    // TODO: implement dispose
    super.dispose();
    if (controller != null) {
      controller.dispose();
    }
  }
}
Reloaded 0 of 947 libraries in 1,515ms.
I/chatty  ( 9839): uid=10133(com.example.market) 1.ui identical 2 lines
I/flutter ( 9839): AppInfo  v  TopBannerWidget_build
I/flutter ( 9839): ══╡ EXCEPTION CAUGHT BY WIDGETS LIBRARY ╞═══════════════════════════════════════════════════════════
I/flutter ( 9839): The following assertion was thrown while finalizing the widget tree:
I/flutter ( 9839): EvaProWidgetState#0f3c5(tickers: tracking 1 ticker) was disposed with an active Ticker.
I/flutter ( 9839): EvaProWidgetState created a Ticker via its TickerProviderStateMixin, but at the time dispose() was
I/flutter ( 9839): called on the mixin, that Ticker was still active. All Tickers must be disposed before calling
I/flutter ( 9839): super.dispose().
I/flutter ( 9839): Tickers used by AnimationControllers should be disposed by calling dispose() on the
I/flutter ( 9839): AnimationController itself. Otherwise, the ticker will leak.
I/flutter ( 9839): The offending ticker was:
I/flutter ( 9839):   _WidgetTicker(created by EvaProWidgetState#0f3c5(lifecycle state: created, tickers: tracking 0
I/flutter ( 9839):   tickers))
I/flutter ( 9839):   The stack trace when the _WidgetTicker was actually created was:

解决方案

@override
  void dispose() {
    // TODO: implement dispose
    if (controller != null) {
      controller.dispose();
    }
    super.dispose();
  }

pull_to_refresh

No named parameter with the name 'keyboardDismissBehavior'

解决方案

  could not find a Material 

The following assertion was thrown building TextField(controller:
TextEditingController#2ed1a(TextEditingValue(text: ┤四大范德萨方式ADF反对党是发生大幅撒地方├, selection:
TextSelection(baseOffset: 21, extentOffset: 21, affinity: TextAffinity.downstream, isDirectional:
false), composing: TextRange(start: -1, end: -1))), autofocus: true, dirty, dependencies:
[MediaQuery, UnmanagedRestorationScope], state: _TextFieldState#884a1):
No Material widget found.
TextField widgets require a Material widget ancestor.
In material design, most widgets are conceptually "printed" on a sheet of material. In Flutter's
material library, that material is represented by the Material widget. It is the Material widget
that renders ink splashes, for instance. Because of this, many material library widgets require that
there be a Material widget in the tree above them.
To introduce a Material widget, you can either directly include one, or use a widget that contains
Material itself, such as a Card, Dialog, Drawer, or Scaffold.
The specific widget that could not find a Material ancestor was:
  TextField
The ancestors of this widget were:
  ...
  Container
  Expanded
  Row
  InputPage
  Semantics
  ...

The relevant error-causing widget was:

原代码:

 @override
  Widget build(BuildContext context) {
    return  Row(
        children: []
);

 解决方案:  添加Scaffold()

@override
  Widget build(BuildContext context) {
    return Scaffold(
      body: Row(
        children: [
          
        ],
      ),
      
    );
  }

 This widget has been unmounted, so the State no longer has a context (and should be considered defunct)

showDialog<void>(
      context: context,
      barrierDismissible: false, // user must tap button!
      builder: (BuildContext context) {
        return AlertDialog(
          title: null,
          content: SingleChildScrollView(
              child: ListBody(
            children:[],
          )),
          actions: <Widget>[
            FlatButton(
              child: Text('关闭'),
              onPressed: () {
                Navigator.of(context).pop();
              },
            ),
          ],
        );
      },
    );

Navigator.of(context).pop();

关闭对话框传递的context应该是builder参数对应的函数里面的context,不应该是State对应的context.

如果传递State对应的context,那么State被销毁后对话框还会显示.

Element、BuildContext和RenderObject #

 Unhandled Exception: MissingPluginException(No implementation found for method pickImage on channel plugins.flutter.io/image_picker)

解决方案 

点击工具栏绿色箭头运行工程(不通过 flutter run 命令来启动工程)

  

  • 9
    点赞
  • 9
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 2
    评论
### 回答1: 很抱歉,我不太清楚Flutter报错Error waiting for a debug connection: The log reader stopped unexpectedly这个问题,但我建议您可以搜索Flutter官方文档,了解相关解决方案,以解决该问题。 ### 回答2: 出现"Flutter报错Error waiting for a debug connection: The log reader stopped unexpectedly"这个错误是因为Flutter出现了一些问题,导致无法建立与调试连接的通信。可能出现这个问题的原因有以下几种情况: 1. 设备连接问题:可能是设备没有正确连接到电脑,或者连接的USB线出现了问题。可以尝试重新连接设备并重启Flutter应用程序。 2. 调试环境问题:可能是Flutter SDK或开发环境出现了一些错误或配置问题。可以尝试重新安装Flutter SDK并更新开发环境到最新版本。 3. 插件冲突问题:可能是已安装的某些插件与Flutter框架不兼容,导致了错误的发生。可以尝试暂时禁用插件并重新运行应用程序,查看是否能够解决问题。 4. Flutter版本问题:可能是使用的Flutter版本与项目依赖的Flutter版本不一致。可以尝试更新或降级Flutter版本,以解决依赖问题。 总之,出现这个错误时,我们可以检查和排除以上几个可能的原因,寻找合适的解决方法。如果以上方法仍然无法解决问题,可以参考Flutter开发者社区的讨论或向官方支持渠道寻求帮助,以获取更详细的帮助和解决方案。 ### 回答3: Flutter报错Error waiting for a debug connection: The log reader stopped unexpectedly,这是由于Flutter的调试连接遇到了问题并出现错误。一般来说,这个问题可能是由于以下几个原因导致的: 首先,可能是由于设备或模拟器的连接问题引起的。您可以尝试重新启动设备或模拟器,然后重新运行Flutter应用程序,看看问题是否解决。 其次,可能是由于Flutter SDK或Dart SDK的版本不匹配导致的。您可以尝试更新Flutter SDK和Dart SDK到最新版本,然后重新构建和运行应用程序,看看问题是否解决。 另外,可能是由于您的应用程序代码中存在bug或错误导致的。您可以仔细检查您的代码,尤其是与调试连接相关的部分,看看是否有任何错误或问题,并进行相应的修复。 最后,如果以上方法都没有解决问题,您可以尝试清除Flutter项目的缓存。您可以使用命令"flutter clean"清除项目的缓存,然后重新构建和运行应用程序,看看问题是否解决。 总结来说,Flutter报错Error waiting for a debug connection: The log reader stopped unexpectedly可能是由设备连接问题、SDK版本不匹配、应用程序代码错误或缓存问题等原因引起的。您可以根据具体情况尝试不同的解决方法来解决这个问题。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

️ 邪神

你自己看着办,你喜欢打赏我就赏

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值