Error: Type 'ui.TextHeightBehavior' not found in flutter

Error: Type 'ui.TextHeightBehavior' not found in flutter

我在终端命令中 flutter build appbundle 时遇到问题

编译器消息:

    ../../flutter/packages/flutter/lib/src/widgets/basic.dart:5149:9: Error: Type 'ui.TextHeightBehavior' not found.
      final ui.TextHeightBehavior textHeightBehavior;                       
            ^^^^^^^^^^^^^^^^^^^^^                                           
    ../../flutter/packages/flutter/lib/src/widgets/text.dart:149:9: Error: Type 'ui.TextHeightBehavior' not found.
      final ui.TextHeightBehavior textHeightBehavior;                       
            ^^^^^^^^^^^^^^^^^^^^^                                           
    ../../flutter/packages/flutter/lib/src/widgets/text.dart:432:9: Error: Type 'ui.TextHeightBehavior' not found.
      final ui.TextHeightBehavior textHeightBehavior;                       
            ^^^^^^^^^^^^^^^^^^^^^                                           
    ../../flutter/packages/flutter/lib/src/rendering/paragraph.dart:78:5: Error: Type 'ui.TextHeightBehavior' not found.
        ui.TextHeightBehavior textHeightBehavior,                           
        ^^^^^^^^^^^^^^^^^^^^^                                               
    ../../flutter/packages/flutter/lib/src/rendering/paragraph.dart:281:3: Error: Type 'ui.TextHeightBehavior' not found.
      ui.TextHeightBehavior get textHeightBehavior => _textPainter.textHeightBehavior;
      ^^^^^^^^^^^^^^^^^^^^^                                                 
    ../../flutter/packages/flutter/lib/src/rendering/paragraph.dart:282:26: Error: Type 'ui.TextHeightBehavior' not found.
      set textHeightBehavior(ui.TextHeightBehavior value) {                 
                             ^^^^^^^^^^^^^^^^^^^^^                          
    ../../flutter/packages/flutter/lib/src/painting/text_painter.dart:145:5: Error: Type 'ui.TextHeightBehavior' not found.
        ui.TextHeightBehavior textHeightBehavior,                           
        ^^^^^^^^^^^^^^^^^^^^^                                               
    ../../flutter/packages/flutter/lib/src/painting/text_painter.dart:346:3: Error: Type 'ui.TextHeightBehavior' not found.
      ui.TextHeightBehavior get textHeightBehavior => _textHeightBehavior;  
      ^^^^^^^^^^^^^^^^^^^^^                                                 
    ../../flutter/packages/flutter/lib/src/painting/text_painter.dart:347:3: Error: Type 'ui.TextHeightBehavior' not found.
      ui.TextHeightBehavior _textHeightBehavior;                            
      ^^^^^^^^^^^^^^^^^^^^^                                                 
    ../../flutter/packages/flutter/lib/src/painting/text_painter.dart:348:26: Error: Type 'ui.TextHeightBehavior' not found.
      set textHeightBehavior(ui.TextHeightBehavior value) {                 
                             ^^^^^^^^^^^^^^^^^^^^^                          
    ../../flutter/packages/flutter/lib/src/painting/text_style.dart:1070:5: Error: Type 'ui.TextHeightBehavior' not found.
        ui.TextHeightBehavior textHeightBehavior,                           
        ^^^^^^^^^^^^^^^^^^^^^                                               
    ../../flutter/packages/flutter/lib/src/widgets/basic.dart:5149:12: Error: 'TextHeightBehavior' isn't a type.
      final ui.TextHeightBehavior textHeightBehavior;                       
               ^^^^^^^^^^^^^^^^^^                                           
    ../../flutter/packages/flutter/lib/src/widgets/text.dart:149:12: Error: 'TextHeightBehavior' isn't a type.
      final ui.TextHeightBehavior textHeightBehavior;                       
               ^^^^^^^^^^^^^^^^^^                                           
    ../../flutter/packages/flutter/lib/src/widgets/text.dart:200:43: Error: 'TextHeightBehavior' isn't a type.
        properties.add(DiagnosticsProperty<ui.TextHeightBehavior>('textHeightBehavior', textHeightBehavior, defaultValue: null));
                                              ^^^^^^^^^^^^^^^^^^            
    ../../flutter/packages/flutter/lib/src/widgets/text.dart:432:12: Error: 'TextHeightBehavior' isn't a type.
      final ui.TextHeightBehavior textHeightBehavior;                       
               ^^^^^^^^^^^^^^^^^^                                           
    ../../flutter/packages/flutter/lib/src/widgets/text.dart:487:43: Error: 'TextHeightBehavior' isn't a type.
        properties.add(DiagnosticsProperty<ui.TextHeightBehavior>('textHeightBehavior', textHeightBehavior, defaultValue: null));
                                              ^^^^^^^^^^^^^^^^^^            
    ../../flutter/packages/flutter/lib/src/rendering/paragraph.dart:78:8: Error: 'TextHeightBehavior' isn't a type.
        ui.TextHeightBehavior textHeightBehavior,                           
           ^^^^^^^^^^^^^^^^^^                                               
    ../../flutter/packages/flutter/lib/src/rendering/paragraph.dart:282:29: Error: 'TextHeightBehavior' isn't a type.
      set textHeightBehavior(ui.TextHeightBehavior value) {                 
                                ^^^^^^^^^^^^^^^^^^                          
    ../../flutter/packages/flutter/lib/src/painting/text_painter.dart:145:8: Error: 'TextHeightBehavior' isn't a type.
        ui.TextHeightBehavior textHeightBehavior,                           
           ^^^^^^^^^^^^^^^^^^                                               
    ../../flutter/packages/flutter/lib/src/painting/text_painter.dart:347:6: Error: 'TextHeightBehavior' isn't a type.
      ui.TextHeightBehavior _textHeightBehavior;                            
         ^^^^^^^^^^^^^^^^^^                                                 
    ../../flutter/packages/flutter/lib/src/painting/text_painter.dart:348:29: Error: 'TextHeightBehavior' isn't a type.
      set textHeightBehavior(ui.TextHeightBehavior value) {                 
                                ^^^^^^^^^^^^^^^^^^                          
    ../../flutter/packages/flutter/lib/src/painting/text_painter.dart:422:7: Error: No named parameter with the name 'textHeightBehavior'.
          textHeightBehavior: _textHeightBehavior,                          
          ^^^^^^^^^^^^^^^^^^                                                
    org-dartlang-sdk:///flutter/lib/ui/text.dart:865:3: Context: Found this candidate, but the arguments don't match.
      ParagraphStyle({                                                      
      ^^^^^^^^^^^^^^                                                        
    ../../flutter/packages/flutter/lib/src/painting/text_style.dart:1070:8: Error: 'TextHeightBehavior' isn't a type.
        ui.TextHeightBehavior textHeightBehavior,                           
           ^^^^^^^^^^^^^^^^^^                                               
    ../../flutter/packages/flutter/lib/src/painting/text_style.dart:1091:7: Error: No named parameter with the name 'textHeightBehavior'.
          textHeightBehavior: textHeightBehavior,   

                        
      ^^^^^^^^^^^^^^^^^^                                                
org-dartlang-sdk:///flutter/lib/ui/text.dart:865:3: Context: Found this candidate, but the arguments don't match.
  ParagraphStyle({                                                      
  ^^^^^^^^^^^^^^                                                        
Target kernel_snapshot failed: Exception: Errors during snapshot creation: null
build failed.                                                           
                                                                        
FAILURE: Build failed with an exception.    

                        
                                                                    
  • Where: Script '/Users/mac/Downloads/flutter/packages/flutter_tools/gradle/flutter.gradle' line: 801
* What went wrong:                                                      
Execution failed for task ':app:compileFlutterBuildRelease'.            
> Process 'command '/Users/mac/Downloads/flutter/bin/flutter'' finished with non-zero exit value 1

**这是我的颤振医生:**

[✓] Flutter (Channel master, v1.14.7-pre.83, on Mac OS X 10.15.2 19C57, locale en-ID) • Flutter version 1.14.7-pre.83 at /Users/mac/flutter • Framework revision e10df3c1a6 (2 days ago), 2020-02-01 11:23:01 +0800 • Engine revision e625e174c5 • Dart version 2.8.0 (build 2.8.0-dev.6.0 5ae5aff640)

[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.2) • Android SDK at /Users/mac/Library/Android/sdk • Android NDK location not configured (optional; useful for native profiling support) • Platform android-29, build-tools 29.0.2 • Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java • Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b49-5587405) • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 11.3.1) • Xcode at /Applications/Xcode.app/Contents/Developer • Xcode 11.3.1, Build version 11C504 • CocoaPods version 1.8.4

[✓] Android Studio (version 3.5) • Android Studio at /Applications/Android Studio.app/Contents • Flutter plugin version 43.0.1 • Dart plugin version 191.8593 • Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b49-5587405)

[✓] IntelliJ IDEA Community Edition (version 2018.2.2) • IntelliJ at /Applications/IntelliJ IDEA CE.app • Flutter plugin version 29.1.3 • Dart plugin version 182.4129.13

之前我成功将我的应用程序上传到 Google Playstore。但是当我想更新我的应用程序时,我遇到了这个问题。先谢谢你

换个 flutter master 在你的项目的终端写 颤动通道稳定

您似乎在使用旧的 Flutter master 频道,以修复升级到最新的 stable 频道

要按照以下命令切换频道:

flutter channel stable
flutter clean

然后 运行

flutter upgrade       //to ensure you're on the latest.

在您应用的 pubspec.yaml 文件中查找此行:flutter_widget_from_html 并使用版本 ^ 0.5.1 + 3

例如:flutter_widget_from_html: ^0.5.1+3

然后点击发布升级和运行你的应用程序