東川印記

一本東川,笑看爭龍斗虎;寰茫兦者,度橫佰昧人生。

Flutter学习02之passbox

2022年5月16日星期一



需要继承数据库,按官方文档,继承了sqlflite和path。。。。

1,path依赖sdk版本高

Because every version of flutter_test from sdk depends on path 1.8.0 and hello depends on path 1.8.1, flutter_test from sdk is forbidden.
So, because hello depends on flutter_test any from sdk, version solving failed.
pub get failed (1; So, because hello depends on flutter_test any from sdk, version solving failed.)

修改path版本从 ^1.8.1 到 1.8.0 即可。


2,sqlite库在macos平台运行需要先 pod install

在Android平台运行直接就可以,在macos运行报错

Running pod install...
CocoaPods' output:

      Preparing

    Analyzing dependencies

    Inspecting targets to integrate
      Using `ARCHS` setting to build architectures of target `Pods-Runner`: (``)

    Fetching external sources
    -> Fetching podspec for `FlutterMacOS` from `Flutter/ephemeral`
    -> Fetching podspec for `path_provider_macos` from `Flutter/ephemeral/.symlinks/plugins/path_provider_macos/macos`
    -> Fetching podspec for `shared_preferences_macos` from `Flutter/ephemeral/.symlinks/plugins/shared_preferences_macos/macos`
    -> Fetching podspec for `sqflite` from `Flutter/ephemeral/.symlinks/plugins/sqflite/macos`

    Resolving dependencies of `Podfile`
      CDN: trunk Relative path: CocoaPods-version.yml exists! Returning local because checking is only performed in repo update
      CDN: trunk URL couldn't be downloaded: https://cdn.cocoapods.org/all_pods_versions_f_4_e.txt Response: Timeout was reached, retries: 4

。。。

    /usr/local/bin/pod:23:in `<main>'

Exception: Error running pod install

然后到ios/mac目录安pod

SENRSL:macos senrsl$ Pod install
Analyzing dependencies
[!] CDN: trunk URL couldn't be downloaded: https://cdn.cocoapods.org/all_pods_versions_f_4_e.txt Response: Timeout was reached
SENRSL:macos senrsl$

网络问题

SENRSL:macos senrsl$ Pod install
Analyzing dependencies
Downloading dependencies
Installing FMDB (2.7.5)
Installing FlutterMacOS (1.0.0)
Installing path_provider_macos (0.0.1)
Installing shared_preferences_macos (0.0.1)
Installing sqflite (0.0.2)
Generating Pods project
Integrating client project
Pod installation complete! There are 4 dependencies from the Podfile and 5 total pods installed.

[!] CocoaPods did not set the base configuration of your project because your project already has a custom config set. In order for CocoaPods integration to work at all, please either set the base configurations of the target `Runner` to `Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig` or include the `Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig` in your build configuration (`Runner/Configs/AppInfo.xcconfig`).

[!] CocoaPods did not set the base configuration of your project because your project already has a custom config set. In order for CocoaPods integration to work at all, please either set the base configurations of the target `Runner` to `Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig` or include the `Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig` in your build configuration (`Runner/Configs/AppInfo.xcconfig`).

[!] CocoaPods did not set the base configuration of your project because your project already has a custom config set. In order for CocoaPods integration to work at all, please either set the base configurations of the target `Runner` to `Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig` or include the `Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig` in your build configuration (`Runner/Configs/AppInfo.xcconfig`).
SENRSL:macos senrsl$

然后运行macos平台,虽然能运行,但是报警

/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.1.sdk/usr/include/dispatch/queue.h:1498:1: note: 'dispatch_queue_set_specific' has been marked as being introduced in macOS 10.7 here, but the deployment target is macOS 10.6.0

竟然嫌弃我的版本低。。。。

能跑就行。。。。

这个问题,后续运行又报

hello/macos/Pods/Pods.xcodeproj: warning: The macOS deployment target 'MACOSX_DEPLOYMENT_TARGET' is set to 10.6, but the range of supported deployment target versions is 10.9 to 12.2. (in target 'FMDB' from project 'Pods')

也就是说,可以改配置文件,就不报了。。。。


3,The default constructor is already defined. (Documentation)  Try giving one of the constructors a name.

构造函数只能同时定义一个,被认为是默认的构造函数

下面这么写就报错

    DogBean(this.id, this.name, this.age);

    DogBean(this.name, this.age);

多个定义时,需要增加name

DogBean.auto(this.name, this.age);


4,flutter logo

各个平台都要导一遍也是很麻烦的事情。。。。

SENRSL:passbox senrsl$ tree
.
├── android
│   ├── logo144.png
│   ├── logo192.png
│   ├── logo48.png
│   ├── logo72.png
│   └── logo96.png
├── ios
│   ├── 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
├── logo1024.png
├── macos
│   ├── app_icon_1024.png
│   ├── app_icon_128.png
│   ├── app_icon_16.png
│   ├── app_icon_256.png
│   ├── app_icon_32.png
│   ├── app_icon_512.png
│   └── app_icon_64.png
├── web
│   ├── Icon-192.png
│   ├── Icon-512.png
│   ├── Icon-maskable-192.png
│   ├── Icon-maskable-512.png
│   └── favicon.png
└── windows
    └── app_icon.ico

5 directories, 34 files
SENRSL:passbox senrsl$

其中有 是否透明的区别,以及是否alpha通道的差别。。。。

Linux平台竟然没有单独的logo。。。。


5,The method 'forEach' can't be unconditionally invoked because the receiver can be 'null'. (Documentation)


The method 'forEach' can't be unconditionally invoked because the receiver can be 'null'. (Documentation)
'_listBean' refers to a property so it couldn't be promoted. See http://dart.dev/go/non-promo-property (pass_list.dart:14).
 Try making the call conditional (using '?.') or adding a null check to the target ('!').
This expression has a type of 'void' so its value can't be used. (Documentation)  Try checking to see if you're using the correct API; there might be a function or call that returns void you didn't expect. Also check type parameters and variables which might also be void.


凉。。。。


--
senRsl
2022年02月18日11:19:29

没有评论 :

发表评论