├── .gitignore
├── FRouter
├── FRouter.dart
└── test_frouter.dart
├── LICENSE
├── README-EN.md
├── README.md
├── code_plugins
├── README-CN.md
├── have_new_keywords
│ ├── dart.json
│ └── settings.jar
├── no_new_keywords
│ ├── dart.json
│ └── settings.jar
└── readme.md
├── flutter-learning-doc-resources
├── Flutter有关博客讲解.md
├── Flutter相关译文.md
└── 官方文档译文
│ └── Android开发者参考.md
├── pics
├── Dart的模板设置.png
├── Dart编辑模板字段.png
├── Dart语言.png
├── Dart语言在Flutter里面报错.png
├── Flutter Inspector1.png
├── Flutter Inspector2.png
├── Flutter和react native的对比.png
├── Run Console1.png
├── Run Console2.png
├── app.png
├── app2.png
├── app3.png
├── app4.png
├── app5.png
├── app6.png
├── donation.png
├── download-flutter.png
├── flutter-dos1.png
├── flutter-dos2.png
├── flutter-dos3.png
├── flutter-pits1.png
├── flutter-pits10.png
├── flutter-pits11.png
├── flutter-pits12.png
├── flutter-pits13.png
├── flutter-pits14.png
├── flutter-pits15.png
├── flutter-pits2.png
├── flutter-pits3.png
├── flutter-pits4.png
├── flutter-pits5.png
├── flutter-pits6.png
├── flutter-pits7.png
├── flutter-pits8.png
├── flutter-pits9.png
├── logo.png
├── path1.png
├── path2.png
├── plugin-dart.png
├── plugin-flutter.png
├── 公众号二维码.jpg
└── 线性渐变封装图示.png
├── projects
├── dart_demo
│ ├── .gitignore
│ ├── .metadata
│ ├── README.md
│ ├── android
│ │ ├── .gitignore
│ │ ├── app
│ │ │ ├── build.gradle
│ │ │ └── src
│ │ │ │ └── main
│ │ │ │ ├── AndroidManifest.xml
│ │ │ │ ├── java
│ │ │ │ └── com
│ │ │ │ │ └── lzw
│ │ │ │ │ └── dartdemo
│ │ │ │ │ └── MainActivity.java
│ │ │ │ └── res
│ │ │ │ ├── drawable
│ │ │ │ └── launch_background.xml
│ │ │ │ ├── mipmap-hdpi
│ │ │ │ └── ic_launcher.png
│ │ │ │ ├── mipmap-mdpi
│ │ │ │ └── ic_launcher.png
│ │ │ │ ├── mipmap-xhdpi
│ │ │ │ └── ic_launcher.png
│ │ │ │ ├── mipmap-xxhdpi
│ │ │ │ └── ic_launcher.png
│ │ │ │ ├── mipmap-xxxhdpi
│ │ │ │ └── ic_launcher.png
│ │ │ │ └── values
│ │ │ │ └── styles.xml
│ │ ├── build.gradle
│ │ ├── gradle.properties
│ │ ├── gradlew
│ │ ├── gradlew.bat
│ │ └── settings.gradle
│ ├── ios
│ │ ├── .gitignore
│ │ ├── Flutter
│ │ │ ├── AppFrameworkInfo.plist
│ │ │ ├── Debug.xcconfig
│ │ │ └── Release.xcconfig
│ │ ├── Runner.xcodeproj
│ │ │ ├── project.pbxproj
│ │ │ ├── project.xcworkspace
│ │ │ │ └── contents.xcworkspacedata
│ │ │ └── xcshareddata
│ │ │ │ └── xcschemes
│ │ │ │ └── Runner.xcscheme
│ │ ├── Runner.xcworkspace
│ │ │ └── contents.xcworkspacedata
│ │ └── Runner
│ │ │ ├── AppDelegate.h
│ │ │ ├── AppDelegate.m
│ │ │ ├── Assets.xcassets
│ │ │ ├── AppIcon.appiconset
│ │ │ │ ├── Contents.json
│ │ │ │ ├── Icon-App-1024x1024@1x.png
│ │ │ │ ├── Icon-App-20x20@1x.png
│ │ │ │ ├── Icon-App-20x20@2x.png
│ │ │ │ ├── Icon-App-20x20@3x.png
│ │ │ │ ├── Icon-App-29x29@1x.png
│ │ │ │ ├── Icon-App-29x29@2x.png
│ │ │ │ ├── Icon-App-29x29@3x.png
│ │ │ │ ├── Icon-App-40x40@1x.png
│ │ │ │ ├── Icon-App-40x40@2x.png
│ │ │ │ ├── Icon-App-40x40@3x.png
│ │ │ │ ├── Icon-App-60x60@2x.png
│ │ │ │ ├── Icon-App-60x60@3x.png
│ │ │ │ ├── Icon-App-76x76@1x.png
│ │ │ │ ├── Icon-App-76x76@2x.png
│ │ │ │ └── Icon-App-83.5x83.5@2x.png
│ │ │ └── LaunchImage.imageset
│ │ │ │ ├── Contents.json
│ │ │ │ ├── LaunchImage.png
│ │ │ │ ├── LaunchImage@2x.png
│ │ │ │ ├── LaunchImage@3x.png
│ │ │ │ └── README.md
│ │ │ ├── Base.lproj
│ │ │ ├── LaunchScreen.storyboard
│ │ │ └── Main.storyboard
│ │ │ ├── Info.plist
│ │ │ └── main.m
│ ├── lib
│ │ ├── ConvertNumberToChineseMoneyWords.dart
│ │ └── main.dart
│ ├── pubspec.lock
│ ├── pubspec.yaml
│ └── test
│ │ ├── 10-async_demo
│ │ ├── 11-2-async&await
│ │ │ ├── async_demo0.dart
│ │ │ ├── async_demo01.dart
│ │ │ ├── async_demo02.dart
│ │ │ ├── async_demo03.dart
│ │ │ └── async_demo04.dart
│ │ ├── 11-3-define_asynchronous_function
│ │ │ └── define_demo.dart
│ │ ├── 11-4-stream
│ │ │ └── stream_demo.dart
│ │ └── test.txt
│ │ ├── 11-generator
│ │ └── generate_demo.dart
│ │ ├── 12-isolate
│ │ └── isolates_demo.dart
│ │ ├── 3-variable_and_constant
│ │ ├── 3-1-variable_and_constant1.dart
│ │ ├── 3-2-variable_and_constant2.dart
│ │ └── 3-3-variable_and_constant3.dart
│ │ ├── 4-datas-type
│ │ ├── 4-1-num_demo.dart
│ │ ├── 4-2-String_demo.dart
│ │ ├── 4-3-bool_demo.dart
│ │ ├── 4-4-list_demo.dart
│ │ ├── 4-5-map_demo.dart
│ │ └── 4-6-runes_demo.dart
│ │ ├── 5-opertors
│ │ └── opertors_demo.dart
│ │ ├── 6-control_flow_statements
│ │ ├── 6-1-if_else
│ │ │ └── if_else_demo.dart
│ │ ├── 6-2-for
│ │ │ ├── for_demo1.dart
│ │ │ ├── for_demo2.dart
│ │ │ ├── for_demo3.dart
│ │ │ └── for_demo4.dart
│ │ ├── 6-3-while&do_while
│ │ │ └── while_demo.dart
│ │ ├── 6-4-break&continue
│ │ │ └── break&continue_demo.dart
│ │ ├── 6-5-switch&case
│ │ │ └── switch_case_demo.dart
│ │ └── 6-6-assert
│ │ │ └── assert_demo.dart
│ │ ├── 7-exception
│ │ └── exception_demo.dart
│ │ ├── 8-class
│ │ ├── 1-class-type
│ │ │ ├── 1-common-class
│ │ │ │ ├── 1-common_class.dart
│ │ │ │ ├── 2-object_type.dart
│ │ │ │ ├── 3-exdtend_a_class
│ │ │ │ │ ├── 3-extends_demo.dart
│ │ │ │ │ ├── 4-annotation_demo.dart
│ │ │ │ │ └── 5-annotation_use.dart
│ │ │ │ ├── 4-static_variable.dart
│ │ │ │ ├── 5-operator_demo.dart
│ │ │ │ └── 6-nosuchmethod_demo.dart
│ │ │ ├── 2-abstract_class
│ │ │ │ ├── 1-abstract_demo.dart
│ │ │ │ └── 2-abstract_demo.dart
│ │ │ ├── 3-callable_class
│ │ │ │ └── callable_class_demo.dart
│ │ │ ├── 4-enum
│ │ │ │ └── enum_demo.dart
│ │ │ └── 5-mixin
│ │ │ │ ├── 1-create_mixin.dart
│ │ │ │ ├── 2-use_mixin.dart
│ │ │ │ └── 3-use_mixin2.dart
│ │ ├── 2-generics
│ │ │ ├── 1-why_use_enerics.dart
│ │ │ ├── 2-use_list.dart
│ │ │ ├── 3-with-constructor_params.dart
│ │ │ ├── 4-generis_list.dart
│ │ │ ├── 5-limit_params_type.dart
│ │ │ └── 6-generis_methods.dart
│ │ └── 3-functions
│ │ │ ├── 1-common_functions
│ │ │ ├── 1-method_write.dart
│ │ │ ├── 10-method_abstract.dart
│ │ │ ├── 11-method_static.dart
│ │ │ ├── 2-choosable_functuons
│ │ │ │ ├── method_choosable.dart
│ │ │ │ ├── method_choosable2.dart
│ │ │ │ ├── method_choosable3.dart
│ │ │ │ └── method_choosable4.dart
│ │ │ ├── 3-method_params.dart
│ │ │ ├── 4-method_noname.dart
│ │ │ ├── 5-method_resolution.dart
│ │ │ ├── 6-method_closure.dart
│ │ │ ├── 7-method_equals.dart
│ │ │ ├── 8-method_alias.dart
│ │ │ └── 9-get_and_set
│ │ │ │ ├── get_set_demo1.dart
│ │ │ │ └── get_set_demo2.dart
│ │ │ ├── 2-constructor_functions
│ │ │ ├── 1-constructor_common.dart
│ │ │ ├── 2-constructor_params.dart
│ │ │ ├── 3-constructor_default.dart
│ │ │ ├── 4-constructor_named.dart
│ │ │ ├── 5-constructor_not_extends.dart
│ │ │ ├── 6-calling-process
│ │ │ │ ├── calling-process1.dart
│ │ │ │ ├── calling-process2.dart
│ │ │ │ └── calling-process3.dart
│ │ │ ├── 7-constructor_redirect.dart
│ │ │ ├── 8-constructor_constant
│ │ │ │ ├── constructor_constant1.dart
│ │ │ │ └── constructor_constant2.dart
│ │ │ └── 9-constructor_factory.dart
│ │ │ └── 3-init_list
│ │ │ ├── 1-init_list_demo1.dart
│ │ │ ├── 2-init_list_demo2.dart
│ │ │ ├── 3-init_list_demo3.dart
│ │ │ ├── 4-init_list_demo4.dart
│ │ │ └── 5-init_list_demo5.dart
│ │ └── 9-library
│ │ ├── libs
│ │ ├── mylib.dart
│ │ ├── otherlib.dart
│ │ ├── otherlib2.dart
│ │ ├── testlib1.dart
│ │ └── testlib2.dart
│ │ ├── test1.dart
│ │ ├── test2.dart
│ │ └── test3.dart
├── flutter-demo
│ ├── .gitignore
│ ├── .idea
│ │ ├── codeStyles
│ │ │ └── Project.xml
│ │ ├── inspectionProfiles
│ │ │ └── Project_Default.xml
│ │ ├── libraries
│ │ │ ├── Dart_Packages.xml
│ │ │ ├── Dart_SDK.xml
│ │ │ └── Flutter_Plugins.xml
│ │ ├── markdown-navigator.xml
│ │ ├── markdown-navigator
│ │ │ └── profiles_settings.xml
│ │ ├── misc.xml
│ │ ├── modules.xml
│ │ └── workspace.xml
│ ├── .metadata
│ ├── README.md
│ ├── android
│ │ ├── .gitignore
│ │ ├── app
│ │ │ ├── build.gradle
│ │ │ └── src
│ │ │ │ └── main
│ │ │ │ ├── AndroidManifest.xml
│ │ │ │ ├── java
│ │ │ │ └── com
│ │ │ │ │ └── lzw
│ │ │ │ │ └── flutterdemo
│ │ │ │ │ └── MainActivity.java
│ │ │ │ └── res
│ │ │ │ ├── drawable
│ │ │ │ └── launch_background.xml
│ │ │ │ ├── mipmap-hdpi
│ │ │ │ └── ic_launcher.png
│ │ │ │ ├── mipmap-mdpi
│ │ │ │ └── ic_launcher.png
│ │ │ │ ├── mipmap-xhdpi
│ │ │ │ └── ic_launcher.png
│ │ │ │ ├── mipmap-xxhdpi
│ │ │ │ └── ic_launcher.png
│ │ │ │ ├── mipmap-xxxhdpi
│ │ │ │ └── ic_launcher.png
│ │ │ │ └── values
│ │ │ │ └── styles.xml
│ │ ├── build.gradle
│ │ ├── gradle.properties
│ │ ├── gradle
│ │ │ └── wrapper
│ │ │ │ ├── gradle-wrapper.jar
│ │ │ │ └── gradle-wrapper.properties
│ │ ├── gradlew
│ │ ├── gradlew.bat
│ │ └── settings.gradle
│ ├── assets
│ │ └── result.json
│ ├── images
│ │ ├── mipmap-hdpi
│ │ │ ├── ic_launcher.png
│ │ │ └── ic_launcher_round.png
│ │ ├── mipmap-mdpi
│ │ │ ├── ic_launcher.png
│ │ │ └── ic_launcher_round.png
│ │ ├── mipmap-xhdpi
│ │ │ ├── demo.png
│ │ │ ├── ic_launcher.png
│ │ │ └── ic_launcher_round.png
│ │ ├── mipmap-xxhdpi
│ │ │ ├── ic_launcher.png
│ │ │ └── ic_launcher_round.png
│ │ └── mipmap-xxxhdpi
│ │ │ ├── ic_launcher.png
│ │ │ └── ic_launcher_round.png
│ ├── ios
│ │ ├── .gitignore
│ │ ├── Flutter
│ │ │ ├── AppFrameworkInfo.plist
│ │ │ ├── Debug.xcconfig
│ │ │ └── Release.xcconfig
│ │ ├── Runner.xcodeproj
│ │ │ ├── project.pbxproj
│ │ │ ├── project.xcworkspace
│ │ │ │ └── contents.xcworkspacedata
│ │ │ └── xcshareddata
│ │ │ │ └── xcschemes
│ │ │ │ └── Runner.xcscheme
│ │ ├── Runner.xcworkspace
│ │ │ └── contents.xcworkspacedata
│ │ └── Runner
│ │ │ ├── AppDelegate.h
│ │ │ ├── AppDelegate.m
│ │ │ ├── Assets.xcassets
│ │ │ ├── AppIcon.appiconset
│ │ │ │ ├── Contents.json
│ │ │ │ ├── Icon-App-1024x1024@1x.png
│ │ │ │ ├── Icon-App-20x20@1x.png
│ │ │ │ ├── Icon-App-20x20@2x.png
│ │ │ │ ├── Icon-App-20x20@3x.png
│ │ │ │ ├── Icon-App-29x29@1x.png
│ │ │ │ ├── Icon-App-29x29@2x.png
│ │ │ │ ├── Icon-App-29x29@3x.png
│ │ │ │ ├── Icon-App-40x40@1x.png
│ │ │ │ ├── Icon-App-40x40@2x.png
│ │ │ │ ├── Icon-App-40x40@3x.png
│ │ │ │ ├── Icon-App-60x60@2x.png
│ │ │ │ ├── Icon-App-60x60@3x.png
│ │ │ │ ├── Icon-App-76x76@1x.png
│ │ │ │ ├── Icon-App-76x76@2x.png
│ │ │ │ └── Icon-App-83.5x83.5@2x.png
│ │ │ └── LaunchImage.imageset
│ │ │ │ ├── Contents.json
│ │ │ │ ├── LaunchImage.png
│ │ │ │ ├── LaunchImage@2x.png
│ │ │ │ ├── LaunchImage@3x.png
│ │ │ │ └── README.md
│ │ │ ├── Base.lproj
│ │ │ ├── LaunchScreen.storyboard
│ │ │ └── Main.storyboard
│ │ │ ├── Info.plist
│ │ │ └── main.m
│ ├── lib
│ │ ├── CardDemo.dart
│ │ ├── IO.dart
│ │ ├── TabBar.dart
│ │ ├── all_samples
│ │ │ ├── dialog
│ │ │ │ ├── alert_dialog_demo.dart
│ │ │ │ ├── dialogs_demo.dart
│ │ │ │ ├── simple_dialog_demo.dart
│ │ │ │ └── snackbar_demo.dart
│ │ │ ├── list
│ │ │ │ ├── AllListViewDemo.dart
│ │ │ │ ├── list_demo.dart
│ │ │ │ ├── listview_customscrollview.dart
│ │ │ │ ├── listview_dividers.dart
│ │ │ │ ├── listview_gridview.dart
│ │ │ │ ├── listview_horizontal.dart
│ │ │ │ ├── listview_listtitle.dart
│ │ │ │ ├── listview_longlist.dart
│ │ │ │ ├── listview_multi_item.dart
│ │ │ │ ├── listview_multi_level.dart
│ │ │ │ ├── listview_radio_listtitle.dart
│ │ │ │ ├── listview_simple.dart
│ │ │ │ ├── listview_sliver.dart
│ │ │ │ ├── sliver_vs_grid.dart
│ │ │ │ ├── vertical_list_nested_horizontal_list.dart
│ │ │ │ └── 说明.txt
│ │ │ ├── main_page.dart
│ │ │ ├── normal_page.dart
│ │ │ └── router
│ │ │ │ ├── navigator_encapsulation
│ │ │ │ ├── navigator_util.dart
│ │ │ │ └── test_navigator.dart
│ │ │ │ ├── readme.md
│ │ │ │ ├── router_all_sample
│ │ │ │ ├── router_sample1.dart
│ │ │ │ ├── router_sample2.dart
│ │ │ │ ├── router_sample3.dart
│ │ │ │ ├── router_sample4.dart
│ │ │ │ └── router_sample5.dart
│ │ │ │ └── router_easy_sample
│ │ │ │ ├── demo1.dart
│ │ │ │ ├── demo2.dart
│ │ │ │ ├── demo3.dart
│ │ │ │ ├── demo4.dart
│ │ │ │ └── router_demo.dart
│ │ ├── color_test.dart
│ │ ├── image_network.dart
│ │ ├── main.dart
│ │ ├── main2.dart
│ │ ├── page1.dart
│ │ ├── page2.dart
│ │ ├── page3.dart
│ │ ├── progress.dart
│ │ ├── readme.md
│ │ └── view_demo
│ │ │ ├── action
│ │ │ ├── AnimatedListSample.dart
│ │ │ ├── GestureDetectorDemo.dart
│ │ │ ├── HandingTaps_And_ListView.dart
│ │ │ ├── HandlingTaps.dart
│ │ │ ├── OpacityAnimDemo.dart
│ │ │ ├── basic_hero_animation.dart
│ │ │ ├── hero_animation.dart
│ │ │ ├── page4.dart
│ │ │ └── page4_review.dart
│ │ │ ├── list
│ │ │ ├── ShoppingList.dart
│ │ │ └── ShoppingListItem.dart
│ │ │ ├── thirdlib
│ │ │ └── Permissions.dart
│ │ │ └── view
│ │ │ ├── BoxDecorationDemo.dart
│ │ │ ├── CenterDemo.dart
│ │ │ ├── ChipsDemo.dart
│ │ │ ├── ContainerDemo.dart
│ │ │ ├── DecoratedBoxDemo.dart
│ │ │ ├── FractionalOffsetUtil.dart
│ │ │ ├── ImageDemo.dart
│ │ │ ├── ListViewDemo.dart
│ │ │ ├── OpacityDemo.dart
│ │ │ ├── PopMenuButtonDemo.dart
│ │ │ ├── RaisedButtonDemo.dart
│ │ │ ├── RowAndColumnDemo.dart
│ │ │ ├── StackDemo.dart
│ │ │ ├── TextDemo.dart
│ │ │ ├── TextFieldDemo1.dart
│ │ │ └── TextFieldDemo2.dart
│ ├── pics
│ │ ├── list_demo.png
│ │ ├── main_page.png
│ │ ├── normal_page.png
│ │ ├── router_demo.png
│ │ ├── 可折叠的appbar+listview.gif
│ │ └── 多级列表demo.png
│ ├── pubspec.lock
│ ├── pubspec.yaml
│ ├── test
│ │ ├── async.dart
│ │ ├── dart1.dart
│ │ ├── dart2.dart
│ │ ├── dart3.dart
│ │ ├── dart4.dart
│ │ ├── dart5.dart
│ │ ├── dart6.dart
│ │ └── widget_test.dart
│ └── util
│ │ └── FractionalOffsetUtil.dart
├── flutter_adobe_logo
│ ├── flutter_adobe_logo.dart
│ └── sample.gif
├── flutter_white_screen
│ ├── .gitignore
│ ├── .metadata
│ ├── README.md
│ ├── android
│ │ ├── app
│ │ │ ├── build.gradle
│ │ │ └── src
│ │ │ │ └── main
│ │ │ │ ├── AndroidManifest.xml
│ │ │ │ ├── java
│ │ │ │ └── com
│ │ │ │ │ └── awei
│ │ │ │ │ └── flutterwhitescreen
│ │ │ │ │ └── MainActivity.java
│ │ │ │ └── res
│ │ │ │ ├── drawable
│ │ │ │ └── launch_background.xml
│ │ │ │ ├── mipmap-hdpi
│ │ │ │ └── ic_launcher.png
│ │ │ │ ├── mipmap-mdpi
│ │ │ │ └── ic_launcher.png
│ │ │ │ ├── mipmap-xhdpi
│ │ │ │ └── ic_launcher.png
│ │ │ │ ├── mipmap-xxhdpi
│ │ │ │ └── ic_launcher.png
│ │ │ │ ├── mipmap-xxxhdpi
│ │ │ │ └── ic_launcher.png
│ │ │ │ └── values
│ │ │ │ └── styles.xml
│ │ ├── build.gradle
│ │ ├── gradle.properties
│ │ ├── gradle
│ │ │ └── wrapper
│ │ │ │ └── gradle-wrapper.properties
│ │ └── settings.gradle
│ ├── ios
│ │ ├── Flutter
│ │ │ ├── AppFrameworkInfo.plist
│ │ │ ├── Debug.xcconfig
│ │ │ └── Release.xcconfig
│ │ ├── Runner.xcodeproj
│ │ │ ├── project.pbxproj
│ │ │ ├── project.xcworkspace
│ │ │ │ └── contents.xcworkspacedata
│ │ │ └── xcshareddata
│ │ │ │ └── xcschemes
│ │ │ │ └── Runner.xcscheme
│ │ ├── Runner.xcworkspace
│ │ │ └── contents.xcworkspacedata
│ │ └── Runner
│ │ │ ├── AppDelegate.h
│ │ │ ├── AppDelegate.m
│ │ │ ├── Assets.xcassets
│ │ │ ├── AppIcon.appiconset
│ │ │ │ ├── Contents.json
│ │ │ │ ├── Icon-App-1024x1024@1x.png
│ │ │ │ ├── Icon-App-20x20@1x.png
│ │ │ │ ├── Icon-App-20x20@2x.png
│ │ │ │ ├── Icon-App-20x20@3x.png
│ │ │ │ ├── Icon-App-29x29@1x.png
│ │ │ │ ├── Icon-App-29x29@2x.png
│ │ │ │ ├── Icon-App-29x29@3x.png
│ │ │ │ ├── Icon-App-40x40@1x.png
│ │ │ │ ├── Icon-App-40x40@2x.png
│ │ │ │ ├── Icon-App-40x40@3x.png
│ │ │ │ ├── Icon-App-60x60@2x.png
│ │ │ │ ├── Icon-App-60x60@3x.png
│ │ │ │ ├── Icon-App-76x76@1x.png
│ │ │ │ ├── Icon-App-76x76@2x.png
│ │ │ │ └── Icon-App-83.5x83.5@2x.png
│ │ │ └── LaunchImage.imageset
│ │ │ │ ├── Contents.json
│ │ │ │ ├── LaunchImage.png
│ │ │ │ ├── LaunchImage@2x.png
│ │ │ │ ├── LaunchImage@3x.png
│ │ │ │ └── README.md
│ │ │ ├── Base.lproj
│ │ │ ├── LaunchScreen.storyboard
│ │ │ └── Main.storyboard
│ │ │ ├── Info.plist
│ │ │ └── main.m
│ ├── lib
│ │ └── main.dart
│ ├── pubspec.yaml
│ ├── screenshots
│ │ └── screenshots.gif
│ └── test
│ │ └── widget_test.dart
├── hub_demo
│ ├── hub_demo.dart
│ ├── sample.gif
│ └── sample2.gif
└── readme.md
└── readme
├── Dart语法.md
├── Flutter从配置安装到填坑指南详解.md
├── Flutter和react native的对比.md
├── Flutter和原生Android控件对比.md
├── Flutter的需要与原生交互的一些常用库
├── English_docs
│ ├── Common libraries for Flutter.md
│ ├── UI_libs.md
│ ├── data_libs.md
│ └── third_libs.md
├── Flutter的需要与原生交互的一些常用库.md
├── UI_libs.md
├── data_libs.md
└── third_libs.md
└── yarn,nodejs,npm,Flutter有关命令.md
/.gitignore:
--------------------------------------------------------------------------------
1 | # Built application files
2 | *.apk
3 | *.ap_
4 |
5 | # Files for the ART/Dalvik VM
6 | *.dex
7 |
8 | # Java class files
9 | *.class
10 |
11 | # Generated files
12 | bin/
13 | gen/
14 | out/
15 |
16 | # Gradle files
17 | .gradle/
18 | build/
19 |
20 | # Local configuration file (sdk path, etc)
21 | local.properties
22 |
23 | # Proguard folder generated by Eclipse
24 | proguard/
25 |
26 | # Log Files
27 | *.log
28 |
29 | # Android Studio Navigation editor temp files
30 | .navigation/
31 |
32 | # Android Studio captures folder
33 | captures/
34 |
35 | # IntelliJ
36 | *.iml
37 | .idea/workspace.xml
38 | .idea/tasks.xml
39 | .idea/gradle.xml
40 | .idea/assetWizardSettings.xml
41 | .idea/dictionaries
42 | .idea/libraries
43 | .idea/caches
44 |
45 | # Keystore files
46 | # Uncomment the following line if you do not want to check your keystore files in.
47 | #*.jks
48 |
49 | # External native build folder generated in Android Studio 2.2 and later
50 | .externalNativeBuild
51 |
52 | # Google Services (e.g. APIs or Firebase)
53 | google-services.json
54 |
55 | # Freeline
56 | freeline.py
57 | freeline/
58 | freeline_project_description.json
59 |
60 | # fastlane
61 | fastlane/report.xml
62 | fastlane/Preview.html
63 | fastlane/screenshots
64 | fastlane/test_output
65 | fastlane/readme.md
66 |
--------------------------------------------------------------------------------
/code_plugins/README-CN.md:
--------------------------------------------------------------------------------
1 | # 使用说明
2 |
3 | ### ▶【提示:】更多详细的图文使用详细讲解,请看我的博客:[Flutter代码模板,解放双手,提高开发效率必备](https://www.jianshu.com/p/4184745d6983)
4 |
5 |
6 | > 导入到Android Studio 或者 Intellij IDEA
7 |
8 | **Tips: 如果你不喜欢 `new`关键字, 你可以下载 [no_new_keywords/settings.jar](https://github.com/AweiLoveAndroid/Flutter-learning/blob/master/code_plugins/no_new_keywords/settings.jar) 文件, 否则请下载 [have_new_keywords/settings.jar](https://github.com/AweiLoveAndroid/Flutter-learning/blob/master/code_plugins/have_new_keywords/settings.jar) 这个文件。**
9 |
10 |
11 | > 导入到VSCode
12 |
13 | **Tips: 如果你不喜欢 `new`关键字, 你可以下载 [no_new_keywords/dart.json](https://github.com/AweiLoveAndroid/Flutter-learning/blob/master/code_plugins/no_new_keywords/dart.json) 文件, 否则请下载 [have_new_keywords/dart.json](https://github.com/AweiLoveAndroid/Flutter-learning/blob/master/code_plugins/have_new_keywords/dart.json) 这个文件。**
--------------------------------------------------------------------------------
/code_plugins/have_new_keywords/settings.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AweiLoveAndroid/Flutter-learning/0130cb7e22d090a367d2feacbc50ceb1200adde2/code_plugins/have_new_keywords/settings.jar
--------------------------------------------------------------------------------
/code_plugins/no_new_keywords/settings.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AweiLoveAndroid/Flutter-learning/0130cb7e22d090a367d2feacbc50ceb1200adde2/code_plugins/no_new_keywords/settings.jar
--------------------------------------------------------------------------------
/flutter-learning-doc-resources/Flutter有关博客讲解.md:
--------------------------------------------------------------------------------
1 | # 我写的Flutter干货博客:
2 |
3 | #### [安卓开发方式的进化之路]( https://www.jianshu.com/p/44305a99c51a)
4 |
5 | #### [跨平台开发框架和工具集锦](https://www.jianshu.com/p/de459708d9ed)
6 |
7 | #### [Flutter从配置安装到填坑指南详解](https://www.jianshu.com/p/399c01657920)
8 |
9 | #### [老司机用一篇博客带你快速熟悉Dart语法](https://www.jianshu.com/p/3d927a7bf020)
10 |
11 | #### [Flutter学习总结系列----第一章、Flutter基础全面详解](https://www.jianshu.com/p/2c9867e737a1)
12 |
13 | #### [Flutter代码模板,解放双手,提高开发效率必备](https://www.jianshu.com/p/4184745d6983)
14 |
15 | #### [Flutter布局篇(1)--水平和垂直布局详解](https://www.jianshu.com/p/7511cb18a05e)
16 |
17 | #### [Flutter填坑全面总结](https://www.jianshu.com/p/22675c1632dc)
18 |
19 | #### [Flutter 的手势(GestureDetector)分析详解](https://www.jianshu.com/p/3b87ddb022af)
20 |
21 | #### [Flutter路由详解](https://www.jianshu.com/p/6e399b45bbb7)
22 |
23 | #### [手把手带你快速上手调试Flutter项目](https://www.jianshu.com/p/97c4df211791)
24 |
25 | ----
26 |
27 | #### 简书博客:https://www.jianshu.com/u/f408bdadacce
28 | #### 掘金博客:https://juejin.im/user/5a07c6c0f265da430a501017
29 | #### 安卓巴士博客:http://www.apkbus.com/space-uid-944603.html
--------------------------------------------------------------------------------
/flutter-learning-doc-resources/Flutter相关译文.md:
--------------------------------------------------------------------------------
1 | # Flutter相关译文
2 |
3 | [在 Google I/O 2018 观看 Flutter 的正确姿势 (wzasd 翻译)](https://juejin.im/post/5aebd7166fb9a07ab4587b3f)
4 |
5 | [为什么 Flutter 能最好地改变移动开发 (ALVINYEH 翻译)](https://juejin.im/post/5add65c46fb9a07aa541e97e)
6 |
7 | [Flutter 到底有多快?我开发了秒表应用来弄清楚。 (ALVINYEH 翻译)](https://juejin.im/post/5ad861566fb9a045ee01b48d)
8 |
9 | [为 JavaScript 程序员准备的 Flutter 指南 (lsvih 翻译)](https://juejin.im/post/5ac43c536fb9a028da7cbd59)
10 |
11 | [Flutter — 五个你会爱上它的原因 (rockzhai 翻译)](https://juejin.im/post/5a9e7e89f265da2381552542)
12 |
13 | [如何在中国使用 Flutter (mysterytony 翻译)](https://juejin.im/post/5a9f730c6fb9a028d2077ad4)
14 |
15 | [[译]Flutter for Android Developers - Intents](https://juejin.im/post/5a96cd1f5188257a780de9a0)
16 |
17 | [[译]Flutter for Android Developers - Async UI](https://juejin.im/post/5a9a21f8518825558b3d5d35)
18 |
19 | [[译]Flutter for Android Developers - Gesture Detection](https://juejin.im/post/5a9c106151882555872300f2)
--------------------------------------------------------------------------------
/pics/Dart的模板设置.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AweiLoveAndroid/Flutter-learning/0130cb7e22d090a367d2feacbc50ceb1200adde2/pics/Dart的模板设置.png
--------------------------------------------------------------------------------
/pics/Dart编辑模板字段.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AweiLoveAndroid/Flutter-learning/0130cb7e22d090a367d2feacbc50ceb1200adde2/pics/Dart编辑模板字段.png
--------------------------------------------------------------------------------
/pics/Dart语言.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AweiLoveAndroid/Flutter-learning/0130cb7e22d090a367d2feacbc50ceb1200adde2/pics/Dart语言.png
--------------------------------------------------------------------------------
/pics/Dart语言在Flutter里面报错.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AweiLoveAndroid/Flutter-learning/0130cb7e22d090a367d2feacbc50ceb1200adde2/pics/Dart语言在Flutter里面报错.png
--------------------------------------------------------------------------------
/pics/Flutter Inspector1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AweiLoveAndroid/Flutter-learning/0130cb7e22d090a367d2feacbc50ceb1200adde2/pics/Flutter Inspector1.png
--------------------------------------------------------------------------------
/pics/Flutter Inspector2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AweiLoveAndroid/Flutter-learning/0130cb7e22d090a367d2feacbc50ceb1200adde2/pics/Flutter Inspector2.png
--------------------------------------------------------------------------------
/pics/Flutter和react native的对比.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AweiLoveAndroid/Flutter-learning/0130cb7e22d090a367d2feacbc50ceb1200adde2/pics/Flutter和react native的对比.png
--------------------------------------------------------------------------------
/pics/Run Console1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AweiLoveAndroid/Flutter-learning/0130cb7e22d090a367d2feacbc50ceb1200adde2/pics/Run Console1.png
--------------------------------------------------------------------------------
/pics/Run Console2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AweiLoveAndroid/Flutter-learning/0130cb7e22d090a367d2feacbc50ceb1200adde2/pics/Run Console2.png
--------------------------------------------------------------------------------
/pics/app.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AweiLoveAndroid/Flutter-learning/0130cb7e22d090a367d2feacbc50ceb1200adde2/pics/app.png
--------------------------------------------------------------------------------
/pics/app2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AweiLoveAndroid/Flutter-learning/0130cb7e22d090a367d2feacbc50ceb1200adde2/pics/app2.png
--------------------------------------------------------------------------------
/pics/app3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AweiLoveAndroid/Flutter-learning/0130cb7e22d090a367d2feacbc50ceb1200adde2/pics/app3.png
--------------------------------------------------------------------------------
/pics/app4.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AweiLoveAndroid/Flutter-learning/0130cb7e22d090a367d2feacbc50ceb1200adde2/pics/app4.png
--------------------------------------------------------------------------------
/pics/app5.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AweiLoveAndroid/Flutter-learning/0130cb7e22d090a367d2feacbc50ceb1200adde2/pics/app5.png
--------------------------------------------------------------------------------
/pics/app6.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AweiLoveAndroid/Flutter-learning/0130cb7e22d090a367d2feacbc50ceb1200adde2/pics/app6.png
--------------------------------------------------------------------------------
/pics/donation.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AweiLoveAndroid/Flutter-learning/0130cb7e22d090a367d2feacbc50ceb1200adde2/pics/donation.png
--------------------------------------------------------------------------------
/pics/download-flutter.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AweiLoveAndroid/Flutter-learning/0130cb7e22d090a367d2feacbc50ceb1200adde2/pics/download-flutter.png
--------------------------------------------------------------------------------
/pics/flutter-dos1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AweiLoveAndroid/Flutter-learning/0130cb7e22d090a367d2feacbc50ceb1200adde2/pics/flutter-dos1.png
--------------------------------------------------------------------------------
/pics/flutter-dos2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AweiLoveAndroid/Flutter-learning/0130cb7e22d090a367d2feacbc50ceb1200adde2/pics/flutter-dos2.png
--------------------------------------------------------------------------------
/pics/flutter-dos3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AweiLoveAndroid/Flutter-learning/0130cb7e22d090a367d2feacbc50ceb1200adde2/pics/flutter-dos3.png
--------------------------------------------------------------------------------
/pics/flutter-pits1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AweiLoveAndroid/Flutter-learning/0130cb7e22d090a367d2feacbc50ceb1200adde2/pics/flutter-pits1.png
--------------------------------------------------------------------------------
/pics/flutter-pits10.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AweiLoveAndroid/Flutter-learning/0130cb7e22d090a367d2feacbc50ceb1200adde2/pics/flutter-pits10.png
--------------------------------------------------------------------------------
/pics/flutter-pits11.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AweiLoveAndroid/Flutter-learning/0130cb7e22d090a367d2feacbc50ceb1200adde2/pics/flutter-pits11.png
--------------------------------------------------------------------------------
/pics/flutter-pits12.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AweiLoveAndroid/Flutter-learning/0130cb7e22d090a367d2feacbc50ceb1200adde2/pics/flutter-pits12.png
--------------------------------------------------------------------------------
/pics/flutter-pits13.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AweiLoveAndroid/Flutter-learning/0130cb7e22d090a367d2feacbc50ceb1200adde2/pics/flutter-pits13.png
--------------------------------------------------------------------------------
/pics/flutter-pits14.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AweiLoveAndroid/Flutter-learning/0130cb7e22d090a367d2feacbc50ceb1200adde2/pics/flutter-pits14.png
--------------------------------------------------------------------------------
/pics/flutter-pits15.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AweiLoveAndroid/Flutter-learning/0130cb7e22d090a367d2feacbc50ceb1200adde2/pics/flutter-pits15.png
--------------------------------------------------------------------------------
/pics/flutter-pits2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AweiLoveAndroid/Flutter-learning/0130cb7e22d090a367d2feacbc50ceb1200adde2/pics/flutter-pits2.png
--------------------------------------------------------------------------------
/pics/flutter-pits3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AweiLoveAndroid/Flutter-learning/0130cb7e22d090a367d2feacbc50ceb1200adde2/pics/flutter-pits3.png
--------------------------------------------------------------------------------
/pics/flutter-pits4.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AweiLoveAndroid/Flutter-learning/0130cb7e22d090a367d2feacbc50ceb1200adde2/pics/flutter-pits4.png
--------------------------------------------------------------------------------
/pics/flutter-pits5.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AweiLoveAndroid/Flutter-learning/0130cb7e22d090a367d2feacbc50ceb1200adde2/pics/flutter-pits5.png
--------------------------------------------------------------------------------
/pics/flutter-pits6.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AweiLoveAndroid/Flutter-learning/0130cb7e22d090a367d2feacbc50ceb1200adde2/pics/flutter-pits6.png
--------------------------------------------------------------------------------
/pics/flutter-pits7.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AweiLoveAndroid/Flutter-learning/0130cb7e22d090a367d2feacbc50ceb1200adde2/pics/flutter-pits7.png
--------------------------------------------------------------------------------
/pics/flutter-pits8.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AweiLoveAndroid/Flutter-learning/0130cb7e22d090a367d2feacbc50ceb1200adde2/pics/flutter-pits8.png
--------------------------------------------------------------------------------
/pics/flutter-pits9.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AweiLoveAndroid/Flutter-learning/0130cb7e22d090a367d2feacbc50ceb1200adde2/pics/flutter-pits9.png
--------------------------------------------------------------------------------
/pics/logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AweiLoveAndroid/Flutter-learning/0130cb7e22d090a367d2feacbc50ceb1200adde2/pics/logo.png
--------------------------------------------------------------------------------
/pics/path1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AweiLoveAndroid/Flutter-learning/0130cb7e22d090a367d2feacbc50ceb1200adde2/pics/path1.png
--------------------------------------------------------------------------------
/pics/path2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AweiLoveAndroid/Flutter-learning/0130cb7e22d090a367d2feacbc50ceb1200adde2/pics/path2.png
--------------------------------------------------------------------------------
/pics/plugin-dart.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AweiLoveAndroid/Flutter-learning/0130cb7e22d090a367d2feacbc50ceb1200adde2/pics/plugin-dart.png
--------------------------------------------------------------------------------
/pics/plugin-flutter.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AweiLoveAndroid/Flutter-learning/0130cb7e22d090a367d2feacbc50ceb1200adde2/pics/plugin-flutter.png
--------------------------------------------------------------------------------
/pics/公众号二维码.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AweiLoveAndroid/Flutter-learning/0130cb7e22d090a367d2feacbc50ceb1200adde2/pics/公众号二维码.jpg
--------------------------------------------------------------------------------
/pics/线性渐变封装图示.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AweiLoveAndroid/Flutter-learning/0130cb7e22d090a367d2feacbc50ceb1200adde2/pics/线性渐变封装图示.png
--------------------------------------------------------------------------------
/projects/dart_demo/.gitignore:
--------------------------------------------------------------------------------
1 | .DS_Store
2 | .dart_tool/
3 |
4 | .packages
5 | .pub/
6 |
7 | build/
8 |
9 | .flutter-plugins
10 |
--------------------------------------------------------------------------------
/projects/dart_demo/.metadata:
--------------------------------------------------------------------------------
1 | # This file tracks properties of this Flutter project.
2 | # Used by Flutter tool to assess capabilities and perform upgrades etc.
3 | #
4 | # This file should be version controlled and should not be manually edited.
5 |
6 | version:
7 | revision: f9bb4289e9fd861d70ae78bcc3a042ef1b35cc9d
8 | channel: beta
9 |
--------------------------------------------------------------------------------
/projects/dart_demo/README.md:
--------------------------------------------------------------------------------
1 | # dart_demo
2 |
3 | #### [变量和常量](test/3-variable_and_constant)
4 | #### [特殊数据类型](test/4-datas-type)
5 | #### [运算符](test/5-opertors)
6 | #### [控制流程语句](test/6-control_flow_statements)
7 | #### [异常](test/7-exception)
8 | #### [类与函数](test/8-class)
9 | #### [库和可见性](test/9-library)
10 | #### [异步支持](test/10-async_demo)
11 | #### [生成器(Generators)](test/11-generator)
12 | #### [Isolates](test/12-isolate)
--------------------------------------------------------------------------------
/projects/dart_demo/android/.gitignore:
--------------------------------------------------------------------------------
1 | *.iml
2 | *.class
3 | .gradle
4 | /local.properties
5 | /.idea/workspace.xml
6 | /.idea/libraries
7 | .DS_Store
8 | /build
9 | /captures
10 | GeneratedPluginRegistrant.java
11 |
--------------------------------------------------------------------------------
/projects/dart_demo/android/app/build.gradle:
--------------------------------------------------------------------------------
1 | def localProperties = new Properties()
2 | def localPropertiesFile = rootProject.file('local.properties')
3 | if (localPropertiesFile.exists()) {
4 | localPropertiesFile.withReader('UTF-8') { reader ->
5 | localProperties.load(reader)
6 | }
7 | }
8 |
9 | def flutterRoot = localProperties.getProperty('flutter.sdk')
10 | if (flutterRoot == null) {
11 | throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
12 | }
13 |
14 | apply plugin: 'com.android.application'
15 | apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
16 |
17 | android {
18 | compileSdkVersion 27
19 |
20 | lintOptions {
21 | disable 'InvalidPackage'
22 | }
23 |
24 | defaultConfig {
25 | // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
26 | applicationId "com.lzw.dartdemo"
27 | minSdkVersion 16
28 | targetSdkVersion 27
29 | versionCode 1
30 | versionName "1.0"
31 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
32 | }
33 |
34 | buildTypes {
35 | release {
36 | // TODO: Add your own signing config for the release build.
37 | // Signing with the debug keys for now, so `flutter run --release` works.
38 | signingConfig signingConfigs.debug
39 | }
40 | }
41 | }
42 |
43 | flutter {
44 | source '../..'
45 | }
46 |
47 | dependencies {
48 | testImplementation 'junit:junit:4.12'
49 | androidTestImplementation 'com.android.support.test:runner:1.0.1'
50 | androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
51 | }
52 |
--------------------------------------------------------------------------------
/projects/dart_demo/android/app/src/main/java/com/lzw/dartdemo/MainActivity.java:
--------------------------------------------------------------------------------
1 | package com.lzw.dartdemo;
2 |
3 | import android.os.Bundle;
4 |
5 | import io.flutter.app.FlutterActivity;
6 | import io.flutter.plugins.GeneratedPluginRegistrant;
7 |
8 | public class MainActivity extends FlutterActivity {
9 | @Override
10 | protected void onCreate(Bundle savedInstanceState) {
11 | super.onCreate(savedInstanceState);
12 | GeneratedPluginRegistrant.registerWith(this);
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/projects/dart_demo/android/app/src/main/res/drawable/launch_background.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
12 |
13 |
--------------------------------------------------------------------------------
/projects/dart_demo/android/app/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AweiLoveAndroid/Flutter-learning/0130cb7e22d090a367d2feacbc50ceb1200adde2/projects/dart_demo/android/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/projects/dart_demo/android/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AweiLoveAndroid/Flutter-learning/0130cb7e22d090a367d2feacbc50ceb1200adde2/projects/dart_demo/android/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/projects/dart_demo/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AweiLoveAndroid/Flutter-learning/0130cb7e22d090a367d2feacbc50ceb1200adde2/projects/dart_demo/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/projects/dart_demo/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AweiLoveAndroid/Flutter-learning/0130cb7e22d090a367d2feacbc50ceb1200adde2/projects/dart_demo/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/projects/dart_demo/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AweiLoveAndroid/Flutter-learning/0130cb7e22d090a367d2feacbc50ceb1200adde2/projects/dart_demo/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/projects/dart_demo/android/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
8 |
9 |
--------------------------------------------------------------------------------
/projects/dart_demo/android/build.gradle:
--------------------------------------------------------------------------------
1 | buildscript {
2 | repositories {
3 | google()
4 | jcenter()
5 | }
6 |
7 | dependencies {
8 | classpath 'com.android.tools.build:gradle:3.0.1'
9 | }
10 | }
11 |
12 | allprojects {
13 | repositories {
14 | google()
15 | jcenter()
16 | }
17 | }
18 |
19 | rootProject.buildDir = '../build'
20 | subprojects {
21 | project.buildDir = "${rootProject.buildDir}/${project.name}"
22 | }
23 | subprojects {
24 | project.evaluationDependsOn(':app')
25 | }
26 |
27 | task clean(type: Delete) {
28 | delete rootProject.buildDir
29 | }
30 |
--------------------------------------------------------------------------------
/projects/dart_demo/android/gradle.properties:
--------------------------------------------------------------------------------
1 | org.gradle.jvmargs=-Xmx1536M
2 |
--------------------------------------------------------------------------------
/projects/dart_demo/android/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':app'
2 |
3 | def flutterProjectRoot = rootProject.projectDir.parentFile.toPath()
4 |
5 | def plugins = new Properties()
6 | def pluginsFile = new File(flutterProjectRoot.toFile(), '.flutter-plugins')
7 | if (pluginsFile.exists()) {
8 | pluginsFile.withReader('UTF-8') { reader -> plugins.load(reader) }
9 | }
10 |
11 | plugins.each { name, path ->
12 | def pluginDirectory = flutterProjectRoot.resolve(path).resolve('android').toFile()
13 | include ":$name"
14 | project(":$name").projectDir = pluginDirectory
15 | }
16 |
--------------------------------------------------------------------------------
/projects/dart_demo/ios/.gitignore:
--------------------------------------------------------------------------------
1 | .idea/
2 | .vagrant/
3 | .sconsign.dblite
4 | .svn/
5 |
6 | .DS_Store
7 | *.swp
8 | profile
9 |
10 | DerivedData/
11 | build/
12 | GeneratedPluginRegistrant.h
13 | GeneratedPluginRegistrant.m
14 |
15 | .generated/
16 |
17 | *.pbxuser
18 | *.mode1v3
19 | *.mode2v3
20 | *.perspectivev3
21 |
22 | !default.pbxuser
23 | !default.mode1v3
24 | !default.mode2v3
25 | !default.perspectivev3
26 |
27 | xcuserdata
28 |
29 | *.moved-aside
30 |
31 | *.pyc
32 | *sync/
33 | Icon?
34 | .tags*
35 |
36 | /Flutter/app.flx
37 | /Flutter/app.zip
38 | /Flutter/flutter_assets/
39 | /Flutter/App.framework
40 | /Flutter/Flutter.framework
41 | /Flutter/Generated.xcconfig
42 | /ServiceDefinitions.json
43 |
44 | Pods/
45 | .symlinks/
46 |
--------------------------------------------------------------------------------
/projects/dart_demo/ios/Flutter/AppFrameworkInfo.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleExecutable
8 | App
9 | CFBundleIdentifier
10 | io.flutter.flutter.app
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | App
15 | CFBundlePackageType
16 | FMWK
17 | CFBundleShortVersionString
18 | 1.0
19 | CFBundleSignature
20 | ????
21 | CFBundleVersion
22 | 1.0
23 | MinimumOSVersion
24 | 8.0
25 |
26 |
27 |
--------------------------------------------------------------------------------
/projects/dart_demo/ios/Flutter/Debug.xcconfig:
--------------------------------------------------------------------------------
1 | #include "Generated.xcconfig"
2 |
--------------------------------------------------------------------------------
/projects/dart_demo/ios/Flutter/Release.xcconfig:
--------------------------------------------------------------------------------
1 | #include "Generated.xcconfig"
2 |
--------------------------------------------------------------------------------
/projects/dart_demo/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/projects/dart_demo/ios/Runner.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/projects/dart_demo/ios/Runner/AppDelegate.h:
--------------------------------------------------------------------------------
1 | #import
2 | #import
3 |
4 | @interface AppDelegate : FlutterAppDelegate
5 |
6 | @end
7 |
--------------------------------------------------------------------------------
/projects/dart_demo/ios/Runner/AppDelegate.m:
--------------------------------------------------------------------------------
1 | #include "AppDelegate.h"
2 | #include "GeneratedPluginRegistrant.h"
3 |
4 | @implementation AppDelegate
5 |
6 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
7 | [GeneratedPluginRegistrant registerWithRegistry:self];
8 | // Override point for customization after application launch.
9 | return [super application:application didFinishLaunchingWithOptions:launchOptions];
10 | }
11 |
12 | @end
13 |
--------------------------------------------------------------------------------
/projects/dart_demo/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AweiLoveAndroid/Flutter-learning/0130cb7e22d090a367d2feacbc50ceb1200adde2/projects/dart_demo/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png
--------------------------------------------------------------------------------
/projects/dart_demo/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AweiLoveAndroid/Flutter-learning/0130cb7e22d090a367d2feacbc50ceb1200adde2/projects/dart_demo/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png
--------------------------------------------------------------------------------
/projects/dart_demo/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AweiLoveAndroid/Flutter-learning/0130cb7e22d090a367d2feacbc50ceb1200adde2/projects/dart_demo/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png
--------------------------------------------------------------------------------
/projects/dart_demo/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AweiLoveAndroid/Flutter-learning/0130cb7e22d090a367d2feacbc50ceb1200adde2/projects/dart_demo/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png
--------------------------------------------------------------------------------
/projects/dart_demo/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AweiLoveAndroid/Flutter-learning/0130cb7e22d090a367d2feacbc50ceb1200adde2/projects/dart_demo/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png
--------------------------------------------------------------------------------
/projects/dart_demo/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AweiLoveAndroid/Flutter-learning/0130cb7e22d090a367d2feacbc50ceb1200adde2/projects/dart_demo/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png
--------------------------------------------------------------------------------
/projects/dart_demo/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AweiLoveAndroid/Flutter-learning/0130cb7e22d090a367d2feacbc50ceb1200adde2/projects/dart_demo/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png
--------------------------------------------------------------------------------
/projects/dart_demo/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AweiLoveAndroid/Flutter-learning/0130cb7e22d090a367d2feacbc50ceb1200adde2/projects/dart_demo/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png
--------------------------------------------------------------------------------
/projects/dart_demo/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AweiLoveAndroid/Flutter-learning/0130cb7e22d090a367d2feacbc50ceb1200adde2/projects/dart_demo/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png
--------------------------------------------------------------------------------
/projects/dart_demo/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AweiLoveAndroid/Flutter-learning/0130cb7e22d090a367d2feacbc50ceb1200adde2/projects/dart_demo/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png
--------------------------------------------------------------------------------
/projects/dart_demo/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AweiLoveAndroid/Flutter-learning/0130cb7e22d090a367d2feacbc50ceb1200adde2/projects/dart_demo/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png
--------------------------------------------------------------------------------
/projects/dart_demo/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AweiLoveAndroid/Flutter-learning/0130cb7e22d090a367d2feacbc50ceb1200adde2/projects/dart_demo/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png
--------------------------------------------------------------------------------
/projects/dart_demo/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AweiLoveAndroid/Flutter-learning/0130cb7e22d090a367d2feacbc50ceb1200adde2/projects/dart_demo/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png
--------------------------------------------------------------------------------
/projects/dart_demo/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AweiLoveAndroid/Flutter-learning/0130cb7e22d090a367d2feacbc50ceb1200adde2/projects/dart_demo/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png
--------------------------------------------------------------------------------
/projects/dart_demo/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AweiLoveAndroid/Flutter-learning/0130cb7e22d090a367d2feacbc50ceb1200adde2/projects/dart_demo/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png
--------------------------------------------------------------------------------
/projects/dart_demo/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "filename" : "LaunchImage.png",
6 | "scale" : "1x"
7 | },
8 | {
9 | "idiom" : "universal",
10 | "filename" : "LaunchImage@2x.png",
11 | "scale" : "2x"
12 | },
13 | {
14 | "idiom" : "universal",
15 | "filename" : "LaunchImage@3x.png",
16 | "scale" : "3x"
17 | }
18 | ],
19 | "info" : {
20 | "version" : 1,
21 | "author" : "xcode"
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/projects/dart_demo/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AweiLoveAndroid/Flutter-learning/0130cb7e22d090a367d2feacbc50ceb1200adde2/projects/dart_demo/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png
--------------------------------------------------------------------------------
/projects/dart_demo/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AweiLoveAndroid/Flutter-learning/0130cb7e22d090a367d2feacbc50ceb1200adde2/projects/dart_demo/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png
--------------------------------------------------------------------------------
/projects/dart_demo/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AweiLoveAndroid/Flutter-learning/0130cb7e22d090a367d2feacbc50ceb1200adde2/projects/dart_demo/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png
--------------------------------------------------------------------------------
/projects/dart_demo/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md:
--------------------------------------------------------------------------------
1 | # Launch Screen Assets
2 |
3 | You can customize the launch screen with your own desired assets by replacing the image files in this directory.
4 |
5 | You can also do it by opening your Flutter project's Xcode project with `open ios/Runner.xcworkspace`, selecting `Runner/Assets.xcassets` in the Project Navigator and dropping in the desired images.
--------------------------------------------------------------------------------
/projects/dart_demo/ios/Runner/Base.lproj/Main.storyboard:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/projects/dart_demo/ios/Runner/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleExecutable
8 | $(EXECUTABLE_NAME)
9 | CFBundleIdentifier
10 | $(PRODUCT_BUNDLE_IDENTIFIER)
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | dart_demo
15 | CFBundlePackageType
16 | APPL
17 | CFBundleShortVersionString
18 | 1.0
19 | CFBundleSignature
20 | ????
21 | CFBundleVersion
22 | 1
23 | LSRequiresIPhoneOS
24 |
25 | UILaunchStoryboardName
26 | LaunchScreen
27 | UIMainStoryboardFile
28 | Main
29 | UISupportedInterfaceOrientations
30 |
31 | UIInterfaceOrientationPortrait
32 | UIInterfaceOrientationLandscapeLeft
33 | UIInterfaceOrientationLandscapeRight
34 |
35 | UISupportedInterfaceOrientations~ipad
36 |
37 | UIInterfaceOrientationPortrait
38 | UIInterfaceOrientationPortraitUpsideDown
39 | UIInterfaceOrientationLandscapeLeft
40 | UIInterfaceOrientationLandscapeRight
41 |
42 | UIViewControllerBasedStatusBarAppearance
43 |
44 |
45 |
46 |
--------------------------------------------------------------------------------
/projects/dart_demo/ios/Runner/main.m:
--------------------------------------------------------------------------------
1 | #import
2 | #import
3 | #import "AppDelegate.h"
4 |
5 | int main(int argc, char * argv[]) {
6 | @autoreleasepool {
7 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/projects/dart_demo/test/10-async_demo/11-2-async&await/async_demo0.dart:
--------------------------------------------------------------------------------
1 | import 'dart:async';
2 |
3 | // async延迟功能
4 | main() {
5 | foo(499).then(print);
6 | print("after foo call");
7 | }
8 |
9 |
10 | Future foo(x) async {
11 | print(x);
12 | return x + 1;
13 | }
14 |
15 |
--------------------------------------------------------------------------------
/projects/dart_demo/test/10-async_demo/11-2-async&await/async_demo01.dart:
--------------------------------------------------------------------------------
1 | import 'dart:async';
2 |
3 | void main(){
4 | checkVersion();
5 | }
6 |
7 | Future checkVersion() async {
8 | var version = await lookUpVersion();
9 | // 其他操作
10 | }
11 |
12 | void lookUpVersion(){
13 | // 逻辑...
14 | }
--------------------------------------------------------------------------------
/projects/dart_demo/test/10-async_demo/11-2-async&await/async_demo02.dart:
--------------------------------------------------------------------------------
1 | import 'dart:async';
2 |
3 | void main() {
4 | checkVersion();
5 | }
6 |
7 | Future checkVersion() async {
8 | try {
9 | var version = await lookUpVersion();
10 | } catch (e) {
11 | // 这里可以看到是什么错误。
12 | } finally {
13 | // 正确的解决方式写在这里
14 | }
15 | }
16 |
17 | void lookUpVersion() {
18 | // 逻辑...
19 | }
20 |
--------------------------------------------------------------------------------
/projects/dart_demo/test/10-async_demo/11-2-async&await/async_demo03.dart:
--------------------------------------------------------------------------------
1 | import 'dart:async';
2 |
3 | void main() {
4 | checkVersion();
5 | }
6 |
7 | Future checkVersion() async {
8 | var entrypoint = await findEntrypoint();
9 | var exitCode = await runExecutable(entrypoint, 10);
10 | await flushThenExit(exitCode);
11 | }
12 |
13 | String findEntrypoint() {
14 | // 逻辑...
15 | return 'entrypoint';
16 | }
17 |
18 | String runExecutable(String entrypoint, int args) {
19 | // 逻辑...
20 | return 'executable';
21 | }
22 |
23 | String flushThenExit(String executable) {
24 | // 逻辑...
25 | return 'exit';
26 | }
--------------------------------------------------------------------------------
/projects/dart_demo/test/10-async_demo/11-2-async&await/async_demo04.dart:
--------------------------------------------------------------------------------
1 | import 'dart:async';
2 |
3 | // 要在应用程序的main()函数中使用await,main()方法必须标记为async
4 |
5 | // 结果:
6 | // checkVersion()
7 | // lookUpVersion()
8 | // lookUpVersion()
9 | // In main: version is 版本号:v1.0
10 | Future main() async {
11 | checkVersion();
12 | print('In main: version is ${await lookUpVersion()}');
13 | }
14 |
15 | Future checkVersion() async {
16 | print('checkVersion()');
17 | var version = await lookUpVersion();
18 | }
19 |
20 | Future lookUpVersion() async{
21 | print('lookUpVersion()');
22 | return '版本号:v1.0';
23 | }
--------------------------------------------------------------------------------
/projects/dart_demo/test/10-async_demo/11-3-define_asynchronous_function/define_demo.dart:
--------------------------------------------------------------------------------
1 | import 'dart:async';
2 |
3 | void main(){
4 | lookUpVersion(); // 输出结果:lookUpVersion()同步方法 返回值是:1.0.0
5 | lookUpVersion2(); // 输出结果:lookUpVersion2()异步方法 返回值是:1.0.0
6 | lookUpVersion3(); // 输出结果:lookUpVersion3()异步方法 没有返回值
7 | }
8 |
9 |
10 | String lookUpVersion() {
11 | print('lookUpVersion()同步方法 返回值是:1.0.0');
12 | return '1.0.0';
13 | }
14 |
15 | // 返回值Future
16 | Future lookUpVersion2() async {
17 | print('lookUpVersion2()异步方法 返回值是:1.0.0');
18 | return '1.0.0';
19 | }
20 |
21 | // 返回值Future
22 | Future lookUpVersion3() async {
23 | print('lookUpVersion3()异步方法 没有返回值');
24 | }
--------------------------------------------------------------------------------
/projects/dart_demo/test/10-async_demo/11-4-stream/stream_demo.dart:
--------------------------------------------------------------------------------
1 | import 'dart:io';
2 | import 'dart:convert';
3 |
4 | void main() {
5 | test();
6 | }
7 |
8 | // await for循环的使用示例
9 | // 这里是读取本地文件的内容
10 | Future test() async {
11 | var config = File('d:\\test.txt');
12 | // 打开io流进行文件读取
13 | Stream> inputStream = config.openRead();
14 | var lines = inputStream
15 | // 设置编码格式为utf-8
16 | .transform(utf8.decoder)
17 | .transform(LineSplitter());
18 | try {
19 | await for (var line in lines) {
20 | print('从Stream中获取到的内容是: ${line} \r文本内容长度为:'+
21 | '${line.length}\r=======');
22 | }
23 | print('文件现在没有关闭。。。');
24 | } catch (e) {
25 | print(e);
26 | }
27 | }
--------------------------------------------------------------------------------
/projects/dart_demo/test/10-async_demo/test.txt:
--------------------------------------------------------------------------------
1 | 这是测试内容:
2 | 123456
3 | 文字
4 | abcdefg
5 | ABCDEFG
--------------------------------------------------------------------------------
/projects/dart_demo/test/11-generator/generate_demo.dart:
--------------------------------------------------------------------------------
1 | void main() {
2 | // 返回一个Iterable对象
3 | Iterable naturalsTo(int n) sync* {
4 | int k = 0;
5 | while (k < n) yield k++;
6 | }
7 |
8 | // 生成器是递归的,您可以使用yield*提高性能
9 | Iterable naturalsDownFrom(int n) sync* {
10 | if (n > 0) {
11 | yield n;
12 | yield* naturalsDownFrom(n - 1);
13 | }
14 | }
15 |
16 | // 返回一个Stream对象
17 | Stream asynchronousNaturalsTo(int n) async* {
18 | int k = 0;
19 | while (k < n) yield k++;
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/projects/dart_demo/test/12-isolate/isolates_demo.dart:
--------------------------------------------------------------------------------
1 | import 'dart:isolate';
2 | import 'dart:io';
3 | import 'dart:convert';
4 |
5 | // 在另一个隔离区()中同步读取“D://file.json”
6 | // 结果是{msg: [{title: 你好1, contents: yes}, {title: 你好2, contents: NO}]}
7 | main() async {
8 | // 在其他隔离(isolate)中同步读取文件,然后对其进行解码。
9 | print(await readIsolate());
10 | }
11 |
12 | // 同步读取'D//file.json'(在同一个线程中)
13 | Map readSync() {
14 | JsonCodec().decode(new File('D://file.json').readAsStringSync());
15 | }
16 |
17 | // 在另一个隔离区()中同步读取“D://file.json”
18 | Future readIsolate() async {
19 | final response = new ReceivePort();
20 | await Isolate.spawn(_isolate, response.sendPort);
21 | return response.first;
22 | }
23 |
24 | /// 期望通过[Isolate.spawn]创建
25 | void _isolate(SendPort sendPort) {
26 | sendPort.send(readSync());
27 | }
28 |
29 | // 下面是file.json文件的内容:
30 | // {
31 | // "msg": [
32 | // {
33 | // "title": "你好1",
34 | // "contents": "yes"
35 | // },
36 | // {
37 | // "title": "你好2",
38 | // "contents": "NO"
39 | // }
40 | // ]
41 | // }
42 |
--------------------------------------------------------------------------------
/projects/dart_demo/test/3-variable_and_constant/3-1-variable_and_constant1.dart:
--------------------------------------------------------------------------------
1 | void main() {
2 | // 1.变量的声明3种方式:
3 | var names1 = '张三';
4 | Object names2 = '张三';
5 | dynamic name3 = '李四';
6 | }
7 |
--------------------------------------------------------------------------------
/projects/dart_demo/test/3-variable_and_constant/3-2-variable_and_constant2.dart:
--------------------------------------------------------------------------------
1 | void main() {
2 | // 2.变量的默认值:
3 | int intDefaultValue;
4 | assert(intDefaultValue == null);
5 | print(intDefaultValue); // null
6 | }
7 |
--------------------------------------------------------------------------------
/projects/dart_demo/test/4-datas-type/4-1-num_demo.dart:
--------------------------------------------------------------------------------
1 | void main() {
2 | test1();
3 | test2();
4 | }
5 |
6 | // int 示例
7 | void test1() {
8 | int intNum1 = 10;
9 | print(intNum1); //结果是10
10 | int intNum2 = 0xDEADBEEF;
11 | print(intNum2); //结果是3735928559
12 |
13 | // bitLength 返回存储此int整数所需的最小位数
14 | int a1 = 1; // 占了1个bit 相当于二进制数字 00000000 00000001
15 | int a2 = 12; // 占了4个bit 相当于二进制数字 00000000 00001100
16 | int a3 = 123; // 占了7个bit 相当于二进制数字 00000000 01111011
17 | int a4 = 1234; // 占了11个bit 相当于二进制数字 00000100 11010010
18 | print('${a1.bitLength}'); // 1
19 | print('${a2.bitLength}'); // 4
20 | print('${a3.bitLength}'); // 7
21 | print('${a4.bitLength}'); // 11
22 | }
23 |
24 | // double示例
25 | void test2() {
26 | double doubleNum1 = 1.1;
27 | print(doubleNum1); //结果是1.1
28 | double doubleNum2 = 1.42e5;
29 | print(doubleNum2); //结果是142000.0
30 |
31 | // int自动转double
32 | double test = 12; //打印结果是12.0
33 | print(test); //打印结果是12.0
34 |
35 | // 使用int的api转double
36 | int test2 = 10;
37 | print(test2.toDouble()); // 结果是: 10.0
38 |
39 | // double转int
40 | double test3 = 15.1;
41 | double test4 = 15.1234;
42 | print(test3.toInt()); // 结果是15
43 | print(test4.toInt()); // 结果是15
44 | }
45 |
--------------------------------------------------------------------------------
/projects/dart_demo/test/4-datas-type/4-3-bool_demo.dart:
--------------------------------------------------------------------------------
1 | // bool示例
2 | void main() {
3 | test();
4 | }
5 |
6 | void test() {
7 |
8 | // 检查是否为空字符串
9 | var emptyStr = '';
10 | assert(emptyStr.isEmpty);
11 |
12 | // 检查是否为0
13 | var numberStr = 0;
14 | assert(numberStr <= 0);
15 |
16 | // 检查是否为null
17 | var nullStr;
18 | assert(nullStr == null);
19 |
20 | // 检查是否为NaN
21 | var value = 0 / 0;
22 | assert(value.isNaN);
23 | }
24 |
--------------------------------------------------------------------------------
/projects/dart_demo/test/4-datas-type/4-4-list_demo.dart:
--------------------------------------------------------------------------------
1 | void main() {
2 | test();
3 | test2();
4 | }
5 |
6 | void test() {
7 | //创建一个int类型的list
8 | List list = [10, 7, 23];
9 | print(list); // 输出结果 [10, 7, 23]
10 |
11 | // 要创建一个编译时常量const的list
12 | List constantList = const [10, 3, 15];
13 | print(constantList); // 输出结果 [10, 3, 15]
14 | }
15 |
16 | void test2() {
17 | //把数字1添加到list中,默认是添加到末尾
18 | List list = [10, 7, 23];
19 | list.add(1);
20 | print(list); // 输出结果 [10, 7, 23, 1]
21 |
22 | //移除数字1
23 | list.remove(1);
24 | print(list); // 输出结果 [10, 7, 23]
25 |
26 | //在索引为0的地方插入数字5
27 | list.insert(0, 5);
28 | print(list); // 输出结果 [5, 10, 7, 23]
29 |
30 | //查找10在list中的索引
31 | int value = list.indexOf(10);
32 | print(value); // 输出结果 1
33 |
34 | //查找list中是否包含数字5
35 | bool result = list.contains(5);
36 | print(result);// 输出结果 true
37 |
38 | }
39 |
--------------------------------------------------------------------------------
/projects/dart_demo/test/4-datas-type/4-5-map_demo.dart:
--------------------------------------------------------------------------------
1 | void main() {
2 | test1();
3 | test2();
4 | }
5 |
6 | // 创建
7 | void test1() {
8 | // 直接声明
9 | Map companys = {'first': '阿里巴巴', 'second': '腾讯', 'fifth': '百度'};
10 | print(companys); //打印结果 {first: 阿里巴巴, second: 腾讯, fifth: 百度}
11 |
12 | Map companys1 = new Map();
13 | companys1['first'] = '阿里巴巴';
14 | companys1['second'] = '腾讯';
15 | companys1['fifth'] = '百度';
16 | print(companys1); //打印结果 {first: 阿里巴巴, second: 腾讯, fifth: 百度}
17 |
18 | final fruitConstantMap = const {2: 'apple', 10: 'orange', 18: 'banana'};
19 | print(fruitConstantMap); // {2: apple, 10: orange, 18: banana}
20 | }
21 |
22 | // 增删改查
23 | void test2() {
24 | Map companys = {'first': '阿里巴巴', 'second': '腾讯', 'fifth': '百度'};
25 |
26 | //添加一个新的元素,key为“5”,value为“华为”
27 | companys[5] = '华为';
28 | print(companys); //打印结果 {first: 阿里巴巴, second: 腾讯, fifth: 百度, 5: 华为}
29 |
30 | // 修改元素
31 | companys['first'] = 'alibaba';
32 | print(companys); //打印结果 {first: alibaba, second: 腾讯, fifth: 百度, 5: 华为}
33 |
34 | // 查询元素
35 | bool mapKey = companys.containsKey('second');
36 | bool mapValue = companys.containsValue('百度');
37 | print(mapKey); //结果为:true
38 | print(mapValue); //结果为:true
39 |
40 | // 删除元素
41 | companys.remove('first'); // 移除key为“first”的元素。
42 | print(companys); // 打印结果{second: 腾讯, fifth: 百度, 5: 华为}
43 |
44 | companys.clear(); // 清空map集合的数据。
45 | print(companys); // 打印结果{}
46 | }
47 |
--------------------------------------------------------------------------------
/projects/dart_demo/test/4-datas-type/4-6-runes_demo.dart:
--------------------------------------------------------------------------------
1 | // runes 字符(用于在字符串中表示Unicode字符)
2 | void main() {
3 | test();
4 | }
5 |
6 | void test() {
7 | var clapping = '\u{1f44f}';
8 | print(clapping);
9 | print(clapping.codeUnits);
10 | print(clapping.runes.toList());
11 |
12 | //这里使用String.fromCharCodes方法显示字符图形
13 | Runes input = new Runes(
14 | '\u2665 \u{1f605} \u{1f60e} \u{1f47b} \u{1f596} \u{1f44d}');
15 | print(new String.fromCharCodes(input));
16 | }
17 |
--------------------------------------------------------------------------------
/projects/dart_demo/test/6-control_flow_statements/6-1-if_else/if_else_demo.dart:
--------------------------------------------------------------------------------
1 | void main() {
2 |
3 | String text;
4 | int number = 50;
5 | String urlString = 'http://www.baidu.com/';
6 |
7 | // 确保变量具有非空值
8 | assert(text != null);
9 | // 确保值小于100
10 | assert(number < 100);
11 | // 确保这是一个 https 网址
12 | assert(urlString.startsWith('https'));
13 |
14 | // 要将消息附加到断言,请添加一个字符串作为第二个参数。
15 | assert(urlString.startsWith('https'),
16 | 'URL ($urlString) should start with "https".');
17 | }
18 |
--------------------------------------------------------------------------------
/projects/dart_demo/test/6-control_flow_statements/6-2-for/for_demo1.dart:
--------------------------------------------------------------------------------
1 | void main() {
2 | for (int i = 0; i < 10; i++) {
3 | print(i);
4 | }
5 |
6 | // for循环内部的闭包获取索引的值。
7 | var array = [];
8 | for (var i = 0; i < 10; i++) {
9 | array.add(() => print(i));
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/projects/dart_demo/test/6-control_flow_statements/6-2-for/for_demo2.dart:
--------------------------------------------------------------------------------
1 | void main() {
2 | var numbers = [1, 2, 3, 4, 5, 6, 7, 8, 9];
3 | numbers.forEach((number)=> print(number));
4 | }
5 |
--------------------------------------------------------------------------------
/projects/dart_demo/test/6-control_flow_statements/6-2-for/for_demo3.dart:
--------------------------------------------------------------------------------
1 | void main() {
2 | var list = [1, 2, 3];
3 | for (var data in list) {
4 | print(data);
5 | }
6 | }
7 |
--------------------------------------------------------------------------------
/projects/dart_demo/test/6-control_flow_statements/6-3-while&do_while/while_demo.dart:
--------------------------------------------------------------------------------
1 | void main() {
2 | int a = 10;
3 | while (a > 5) {
4 | print(a);
5 | }
6 |
7 | do {
8 | print(a);
9 | } while (a > 5);
10 | }
11 |
--------------------------------------------------------------------------------
/projects/dart_demo/test/6-control_flow_statements/6-4-break&continue/break&continue_demo.dart:
--------------------------------------------------------------------------------
1 | void main() {
2 | int a = 10;
3 | int b = 15;
4 | while (a > 5) {
5 | if (b > 5) {
6 | print(a);
7 | break;
8 | }
9 | }
10 |
11 | while (a > 5) {
12 | if (b < 10) {
13 | print(b);
14 | continue;
15 | }
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/projects/dart_demo/test/6-control_flow_statements/6-5-switch&case/switch_case_demo.dart:
--------------------------------------------------------------------------------
1 | void main() {
2 | var command = 'OPEN';
3 | switch (command) {
4 | case 'CLOSED':
5 | executeClosed();
6 | break;
7 | case 'PENDING':
8 | executePending();
9 | break;
10 | case 'APPROVED':
11 | executeApproved();
12 | break;
13 | case 'DENIED':
14 | executeDenied();
15 | break;
16 | case 'OPEN':
17 | executeOpen();
18 | break;
19 | default:
20 | executeUnknown();
21 | }
22 | }
23 |
24 | executeClosed(){}
25 | executePending(){}
26 | executeApproved(){}
27 | executeDenied(){}
28 | executeOpen(){}
29 | executeUnknown(){}
--------------------------------------------------------------------------------
/projects/dart_demo/test/6-control_flow_statements/6-6-assert/assert_demo.dart:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AweiLoveAndroid/Flutter-learning/0130cb7e22d090a367d2feacbc50ceb1200adde2/projects/dart_demo/test/6-control_flow_statements/6-6-assert/assert_demo.dart
--------------------------------------------------------------------------------
/projects/dart_demo/test/7-exception/exception_demo.dart:
--------------------------------------------------------------------------------
1 | void main() {
2 | test1('a123');
3 | test2();
4 | test3();
5 | misbehave();
6 | test4();
7 |
8 | try {
9 | misbehave();
10 | } catch (e) {
11 | print('main() finished handling ${e.runtimeType}.');
12 | }
13 | }
14 |
15 | void test1(String num) {
16 | if (num.startsWith('a')) {
17 | print(num);
18 | } else {
19 | throw FormatException('格式化错误');
20 | }
21 | }
22 |
23 | void test2() => throw FormatException('格式化错误');
24 |
25 | test3() {
26 | // try {
27 | // breedMoreLlamas();
28 | // } on Exception {
29 | // buyMoreLlamas();
30 | // }
31 |
32 | // 也可以两个参数的catch
33 | try {
34 | // ···
35 | } on Exception catch (e) {
36 | print('Exception details:\n $e');
37 | } catch (e, s) {
38 | print('Exception details:\n $e');
39 | print('Stack trace:\n $s');
40 | }
41 | }
42 |
43 | breedMoreLlamas() {}
44 | buyMoreLlamas() {}
45 | cleanLlamaStalls() {}
46 |
47 | void misbehave() {
48 | try {
49 | dynamic foo = true;
50 | print(foo++); // 运行时异常
51 | } catch (e) {
52 | print('misbehave() partially handled ${e.runtimeType}.');
53 | rethrow; // 允许调用者查看exception.
54 | }
55 | }
56 |
57 | test4() {
58 | try {
59 | breedMoreLlamas();
60 | } finally {
61 | // 即使抛出异常 也会执行这句代码.
62 | cleanLlamaStalls();
63 | }
64 | // 该finally子句在任何匹配的catch子句之后运行:
65 | try {
66 | breedMoreLlamas();
67 | } catch (e) {
68 | // 首先会处理异常
69 | print('Error: $e');
70 | } finally {
71 | // 然后执行这句语句
72 | cleanLlamaStalls();
73 | }
74 | }
75 |
--------------------------------------------------------------------------------
/projects/dart_demo/test/8-class/1-class-type/1-common-class/1-common_class.dart:
--------------------------------------------------------------------------------
1 | // 普通类
2 | void main(){
3 | new Test().tests();
4 | }
5 | class Test{
6 | void tests(){}
7 | }
--------------------------------------------------------------------------------
/projects/dart_demo/test/8-class/1-class-type/1-common-class/2-object_type.dart:
--------------------------------------------------------------------------------
1 | // 对象类型
2 | void main(){
3 | var a = 10;
4 | var b = 10.0;
5 | var c = '10';
6 | var d = true;
7 | var e = [12.5,13.1];
8 | var f = {3:'5',5:'11'};
9 | var t = new Test();
10 | print('a 的类型是: ${a.runtimeType}'); // a 的类型是: int
11 | print('b 的类型是: ${b.runtimeType}'); // b 的类型是: double
12 | print('c 的类型是: ${c.runtimeType}'); // c 的类型是: String
13 | print('d 的类型是: ${d.runtimeType}'); // d 的类型是: bool
14 | print('e 的类型是: ${e.runtimeType}'); // e 的类型是: List
15 | print('f 的类型是: ${f.runtimeType}'); // f 的类型是: _InternalLinkedHashMap
16 | print('t 的类型是: ${t.runtimeType}'); // t 的类型是: Test
17 |
18 | }
19 | class Test{
20 | }
--------------------------------------------------------------------------------
/projects/dart_demo/test/8-class/1-class-type/1-common-class/3-exdtend_a_class/3-extends_demo.dart:
--------------------------------------------------------------------------------
1 | // 继承一个类 示例代码
2 | class Test {
3 | void test() {
4 | print('Test ==> test()');
5 | }
6 | // ···
7 | }
8 |
9 | class TestChild extends Test {
10 | // @override标注在test()函数上面 表示test()函数是重写父类的
11 | @override
12 | void test() {
13 | super.test();
14 | print('TestChild ==> test()');
15 | }
16 | // ···
17 | }
18 |
19 | // @deprecated的使用 表示过时方法
20 | class Television {
21 | @deprecated
22 | void activate() {
23 | turnOn();
24 | }
25 |
26 | void turnOn() {
27 | //...
28 | }
29 | }
--------------------------------------------------------------------------------
/projects/dart_demo/test/8-class/1-class-type/1-common-class/3-exdtend_a_class/4-annotation_demo.dart:
--------------------------------------------------------------------------------
1 | // 定义元数据
2 | library todo;
3 |
4 | class Todo {
5 | final String who;
6 | final String what;
7 | const Todo(this.who, this.what);
8 | }
--------------------------------------------------------------------------------
/projects/dart_demo/test/8-class/1-class-type/1-common-class/3-exdtend_a_class/5-annotation_use.dart:
--------------------------------------------------------------------------------
1 | import '4-annotation_demo.dart';
2 |
3 | void main(){
4 | doSomething();
5 | }
6 |
7 | // 以下是使用@todo注释的示例:
8 | @Todo('seth', 'make this do something')
9 | void doSomething() {
10 | print('do something');
11 | }
--------------------------------------------------------------------------------
/projects/dart_demo/test/8-class/1-class-type/1-common-class/4-static_variable.dart:
--------------------------------------------------------------------------------
1 |
2 | // 静态变量和方法
3 | void main() {
4 | assert(Test. a == 16);
5 | print(Point.area(5, 4));
6 | }
7 |
8 | // 静态变量
9 | class Test {
10 | static const num a = 16;
11 | // ···
12 | }
13 |
14 |
15 | // 静态方法
16 | class Point {
17 | static num area(num x, num y) {
18 | return (x * y)/2;
19 | }
20 | }
--------------------------------------------------------------------------------
/projects/dart_demo/test/8-class/1-class-type/1-common-class/5-operator_demo.dart:
--------------------------------------------------------------------------------
1 | ////// 重写运算符 ///////
2 |
3 | void main() {
4 | final a = Testoperator(2, 3);
5 | final b = Testoperator(2, 2);
6 | var num1 = Testoperator(4, 5);
7 | var num2= Testoperator(0,1);
8 | print(a + b == num1); // true
9 | print(a - b == num2); // true
10 |
11 | }
12 |
13 | ////// 重写+ 和 - 运算符 ///////
14 | class Testoperator {
15 | final int x, y;
16 |
17 | Testoperator(this.x, this.y);
18 |
19 | Testoperator operator +(Testoperator o) => Testoperator(x + o.x, y + o.y);
20 | Testoperator operator -(Testoperator o) => Testoperator(x - o.x, y - o.y);
21 |
22 | // Operator == and hashCode not shown. For details, see note below.
23 | // ···
24 |
25 | // Override hashCode using strategy from Effective Java, Chapter 11.
26 | @override
27 | int get hashCode {
28 | int result = 17;
29 | result = 37 * result + x.hashCode;
30 | result = 37 * result + y.hashCode;
31 | return result;
32 | }
33 |
34 | // You should generally implement operator == if you override hashCode.
35 | @override
36 | bool operator ==(dynamic other) {
37 | if (other is! Testoperator) return false;
38 | Testoperator person = other;
39 | return (person.x == x && person.y == y);
40 | }
41 | }
--------------------------------------------------------------------------------
/projects/dart_demo/test/8-class/1-class-type/1-common-class/6-nosuchmethod_demo.dart:
--------------------------------------------------------------------------------
1 | /////////// 重写 noSuchMethod ////////////////
2 |
3 | void main() {
4 | TestMethod test = new TestMethod();
5 | dynamic f = test.foo;
6 | // Invokes `Object.noSuchMethod`, not `TestMethod.noSuchMethod`, so it throws.
7 | f(42);
8 | }
9 |
10 |
11 | class TestMethod {
12 | // 除非你重写noSuchMethod,否则使用不存在的成员会导致NoSuchMethodError
13 | @override
14 | dynamic noSuchMethod(Invocation i) {
15 | print('You tried to use a non-existent member: ' +
16 | '${i.memberName}');
17 | }
18 |
19 | dynamic foo();
20 | }
--------------------------------------------------------------------------------
/projects/dart_demo/test/8-class/1-class-type/2-abstract_class/1-abstract_demo.dart:
--------------------------------------------------------------------------------
1 | // 此类声明为abstract,因此无法实例化
2 | abstract class Test {
3 | //定义构造函数,字段,方法...
4 |
5 | // 抽象方法
6 | void test();
7 | }
--------------------------------------------------------------------------------
/projects/dart_demo/test/8-class/1-class-type/2-abstract_class/2-abstract_demo.dart:
--------------------------------------------------------------------------------
1 | // 隐式接口
2 | void main() {
3 | print(sayHello(Person('李四'))); // 你好 张三. 我是 李四.
4 | print(sayHello(PersonImpl())); // 你好 张三 你知道我是谁吗?
5 | }
6 |
7 | // Person类 隐式接口包含hello()
8 | class Person {
9 | // 在接口中,但是仅在此库中可见。
10 | final _name;
11 |
12 | // 不在接口中,因为这是一个构造函数
13 | Person(this._name);
14 |
15 | // 在接口中
16 | String hello(String who) => '你好 $who. 我是 $_name.';
17 | }
18 |
19 | // Person接口的实现
20 | class PersonImpl implements Person {
21 | get _name => '';
22 |
23 | String hello(String name) => '你好 $name 你知道我是谁吗?';
24 | }
25 |
26 | String sayHello(Person person) => person.hello('张三');
27 |
28 | // 一个类也可以实现多个接口,例如:
29 | class ZhangSan implements Run,Life {
30 | //...
31 | }
32 | class Run {}
33 | class Life {}
--------------------------------------------------------------------------------
/projects/dart_demo/test/8-class/1-class-type/3-callable_class/callable_class_demo.dart:
--------------------------------------------------------------------------------
1 | // 可调用的类(Callable Class)
2 | void main() {
3 | var test = new Test();
4 | var result = test(166.6665,"Flutter真好玩",672);
5 | print("$result");// 666.666 Flutter真好玩 666
6 | }
7 | class Test {
8 | // 必须是call函数
9 | call(double a, String b, int c) => '${a*4} ${b} ${c-6}';
10 | }
--------------------------------------------------------------------------------
/projects/dart_demo/test/8-class/1-class-type/4-enum/enum_demo.dart:
--------------------------------------------------------------------------------
1 | //枚举示例
2 |
3 | void main() {
4 | // 判断枚举的索引值是多少
5 | assert(Color.red.index == 0);
6 | print(Color.green.index == 1);
7 | print(Color.blue.index == 2);
8 |
9 | // 获取枚举中所有值的列表
10 | List colors = Color.values;
11 | print(colors[2] == Color.blue);
12 |
13 | // switch中使用枚举
14 | var aColor = Color.blue;
15 | switch (aColor) {
16 | case Color.red:
17 | print('Red');
18 | break;
19 | case Color.green:
20 | print('Green');
21 | break;
22 | default: // 你没有这个 你会看到一个警告
23 | print(aColor); // 'Color.blue'
24 | }
25 | }
26 |
27 | // 声明枚举类型
28 | enum Color { red, green, blue }
29 |
--------------------------------------------------------------------------------
/projects/dart_demo/test/8-class/1-class-type/5-mixin/1-create_mixin.dart:
--------------------------------------------------------------------------------
1 | // mixin
2 |
3 |
4 | // 声明mixin
5 |
6 | // 专家
7 | mixin Expert {
8 | // 发现和解决难题
9 | bool solveProblems = false;
10 |
11 | // 精通数据结构和算法
12 | bool dataStructureAndAlgorithms = false;
13 |
14 | // 会架构设计
15 | bool architectureDesign = false;
16 |
17 | // 性能优化
18 | bool performanceOptimization = false;
19 |
20 | // 熟练掌握计算机系统
21 | bool computerSystem = false;
22 |
23 | void develop() {
24 | // 娱乐节目
25 | if (solveProblems) {
26 | print('发现和解决难题');
27 | }
28 | if (dataStructureAndAlgorithms) {
29 | print('精通数据结构和算法');
30 | }
31 | if (architectureDesign) {
32 | print('会架构设计');
33 | }
34 | if (performanceOptimization) {
35 | print('熟练掌握性能优化');
36 | }
37 | if (computerSystem) {
38 | print('熟练掌握计算机系统');
39 | }
40 | }
41 | }
42 |
43 | // 特性
44 |
45 | // 有效率的
46 | mixin Efficient {
47 | void getEfficientAttrs() {
48 | print('有效率的');
49 | }
50 | }
51 |
52 | // 和蔼的
53 | mixin Kind {
54 | void getKindAttrs() {
55 | print('和蔼的');
56 | }
57 | }
58 |
59 | // 软件架构师
60 | class SoftwareArchitect {
61 | SoftwareArchitect() {
62 | print('软件架构师');
63 | }
64 | }
--------------------------------------------------------------------------------
/projects/dart_demo/test/8-class/1-class-type/5-mixin/2-use_mixin.dart:
--------------------------------------------------------------------------------
1 | import '1-create_mixin.dart';
2 |
3 | // 使用mixin
4 |
5 | void main() {
6 | // 姓名:张三
7 | // 发现和解决难题
8 | // 精通数据结构和算法
9 | // 会架构设计
10 | ACompanySoftwareArchitect architect1 = new ACompanySoftwareArchitect('张三');
11 | architect1.develop();
12 | print('====');
13 | // 姓名:李四
14 | // 发现和解决难题
15 | // 精通数据结构和算法
16 | // 会架构设计
17 | // 熟练掌握性能优化
18 | // 熟练掌握计算机系统
19 | // 有效率的
20 | // 和蔼的
21 | BCompanySoftwareArchitect architect2 = new BCompanySoftwareArchitect('李四');
22 | architect2.develop();
23 | architect2.getEfficientAttrs();
24 | architect2.getKindAttrs();
25 | }
26 |
27 |
28 | // 使用mixin
29 |
30 | // A公司的软件架构师,继承自软件架构师,拥有专家的特性。
31 | class ACompanySoftwareArchitect extends SoftwareArchitect with Expert {
32 | String name;
33 | ACompanySoftwareArchitect(String name) {
34 | this.name = name;
35 | print('姓名:' + name);
36 | solveProblems = true;
37 | dataStructureAndAlgorithms = true;
38 | architectureDesign = true;
39 | }
40 |
41 | @override
42 | void develop() {
43 | super.develop();
44 | }
45 | }
46 |
47 | // B公司的软件架构师,继承自软件架构师,
48 | class BCompanySoftwareArchitect extends SoftwareArchitect
49 | with Expert, Efficient, Kind {
50 | String name;
51 |
52 | BCompanySoftwareArchitect(String name) {
53 | this.name = name;
54 | print('姓名:' + name);
55 | solveProblems = true;
56 | dataStructureAndAlgorithms = true;
57 | architectureDesign = true;
58 | performanceOptimization = true;
59 | computerSystem = true;
60 | }
61 | }
--------------------------------------------------------------------------------
/projects/dart_demo/test/8-class/1-class-type/5-mixin/3-use_mixin2.dart:
--------------------------------------------------------------------------------
1 | import '2-use_mixin.dart';
2 |
3 | // 要指定只有某些类型可以使用mixin
4 | mixin SoftwareDeveloper on ACompanySoftwareArchitect{}
--------------------------------------------------------------------------------
/projects/dart_demo/test/8-class/2-generics/1-why_use_enerics.dart:
--------------------------------------------------------------------------------
1 | // 泛型 demo
2 | void main() {
3 | var names = List();
4 | names.addAll(['Seth', 'Kathy', 'Lars']);
5 | // 报错 The argument type 'int' can't be assigned to the parameter type 'String'.
6 | // names.add(42);
7 |
8 | // 使用泛型以前的调用方式
9 | print(new Test1().getByKey('123'));
10 | print(new Test2().getByKey('456'));
11 | // 使用泛型之后的调用方式
12 | }
13 |
14 | // 使用泛型以前
15 | abstract class ObjectCache {
16 | Object getByKey(String key);
17 | void setByKey(String key, Object value);
18 | }
19 |
20 | abstract class StringCache {
21 | String getByKey(String key);
22 | void setByKey(String key, String value);
23 | }
24 |
25 | class Test1 extends ObjectCache {
26 | @override
27 | Object getByKey(String key) {
28 | return 'object cache';
29 | }
30 |
31 | @override
32 | void setByKey(String key, Object value) {
33 | return null;
34 | }
35 | }
36 |
37 | class Test2 extends StringCache {
38 | @override
39 | String getByKey(String key) {
40 | return 'String cache';
41 | }
42 |
43 | @override
44 | void setByKey(String key, String value) {
45 | return null;
46 | }
47 | }
48 |
49 | // 使用泛型来减少代码重复
50 | abstract class Cache {
51 | T getByKey(T key);
52 | }
53 |
54 | class Test3 extends Cache {
55 | @override
56 | String getByKey(String key) {
57 | // TODO: implement getByKey
58 | return null;
59 | }
60 | }
61 |
--------------------------------------------------------------------------------
/projects/dart_demo/test/8-class/2-generics/2-use_list.dart:
--------------------------------------------------------------------------------
1 | // 泛型 demo
2 | // list或map中使用泛型
3 | void main() {
4 | var numbers = ['11', '22', '33'];
5 | var pages = {
6 | 'index.html': 'Homepage',
7 | 'store.html': 'Store',
8 | 'mine.html': 'Mine'
9 | };
10 | }
--------------------------------------------------------------------------------
/projects/dart_demo/test/8-class/2-generics/3-with-constructor_params.dart:
--------------------------------------------------------------------------------
1 | // 泛型 demo
2 | // 使用带有构造函数的参数化类型
3 | void main() {
4 | var names = List();
5 | names.addAll(['Seth', 'Kathy', 'Lars']);
6 |
7 | // Set类带有一个泛型 from是一个工厂函数
8 | // abstract class Set extends EfficientLengthIterable
9 | // factory Set.from(Iterable elements) = LinkedHashSet.from;
10 | var nameSet = Set.from(names);
11 | }
12 |
--------------------------------------------------------------------------------
/projects/dart_demo/test/8-class/2-generics/4-generis_list.dart:
--------------------------------------------------------------------------------
1 | // 泛型 demo
2 | // 泛型集合及其包含的类型
3 | void main() {
4 | var names = List();
5 | names.addAll(['Seth', 'Kathy', 'Lars']);
6 | print(names is List);// true
7 | print(names.runtimeType);// List
8 | }
9 |
--------------------------------------------------------------------------------
/projects/dart_demo/test/8-class/2-generics/5-limit_params_type.dart:
--------------------------------------------------------------------------------
1 | // 泛型 demo
2 | // 限制参数类型
3 | void main() {
4 | var someBaseClassFoo = Foo();
5 | var extenderFoo = Foo();
6 |
7 | print(someBaseClassFoo.toString());// Instance of Foo
8 | print(extenderFoo.toString());// Instance of Foo
9 |
10 | // 不指定泛型参数也可以使用。
11 | var foo = Foo();
12 | print(foo); // Instance of 'Foo'
13 | //等同于print(foo.toString());
14 | print(foo.toString()); // Instance of 'Foo'
15 |
16 | // 如果指定任何非SomeBaseClass类型会导致错误。
17 | // var foo2 = Foo