您好,欢迎来到步遥情感网。
搜索
您的当前位置:首页flutter note

flutter note

来源:步遥情感网

project types

application
a whole new application
plugin
exposing an android or ios api for developers
package
creating a pure dart component, like a new widget
module
creating a flutter component to add to an android app

commonly used commands

  • Upgrade
    $ flutter upgrade

  • switch channel (stable recommended)
    $ fultter channel beta/dev/master/stable

  • check environment
    $ flutter doctor

flutter for web (in progress)

for details, check article

flutter for desktop

by google
by a 3rd party company, commercial license, check article

problem notes

debug app with blank screen

One possible reason is your environment variable http_proxy/https_proxy has block the communication between flutter compiler and flutter vm on the remote device. If this is the case, we just set an environment variable no_proxy with 127.0.0.1 included to solve this problem.

Memo

Releationships between Widget, Element and RenderObject

[todo] - refer to

Cocoapods

You can install Cocoapods via two ways: homebrew and rubygems

by homebrew

$ brew install cocoapods

by rubygems

$ sudo gem install cocoapods

for details, refer to

rubygems

replace source with chinese mirror

$ gem sources --add https://gems.ruby-china.com/ --remove https://rubygems.org/
$ gem sources -l

Json and Serialization

  • For small project - decode manually
    • or, you can use the following online tool to help you generate the serialization logic
  • For medium to large projects - code generation
      • add a dev dependency - build_runner: ^1.0.0
      • one-time code generation - $ flutter pub run build_runner build
      • generating code continuously - $ flutter pub run build_runner watch
      • this lib will generate a new file named xxx.g.dart with all generated utility functions, however, you’ll need to write the below boilerplate functions
        • factory XXX.fromJson(Map<String, dynamic> json) => _$XXXFromJson(json);
        • Map<String, dynamic> toJson() => _$XXXToJson(this);
  • Flutter does not support runtime reflection, that is why you cannot find a GSON/Jackson/Moshi equivalent in flutter.
    • Runtime reflection interferes with tree shaking. With tree shaking, you can “shake off” unused code from your release builds. This optimizes the app’s size significantly.

For details, refer to

Hot restart/reload and debugging dart code for flutter module

Execute the following command under flutter module root directory,

$ flutter attach

Then, launch your application in debug mode from Android Studio or Xcode.

it seems there’s a problem in attaching a ios emulator, refer to
resolved in new version (1.7.8+hotfix.3)

References

study resources

因篇幅问题不能全部显示,请点此查看更多更全内容

Copyright © 2019- obuygou.com 版权所有 赣ICP备2024042798号-5

违法及侵权请联系:TEL:199 18 7713 E-MAIL:2724546146@qq.com

本站由北京市万商天勤律师事务所王兴未律师提供法律服务