Skip to content

Commit b3302f6

Browse files
authored
Nnbd (#2)
* nnbd, test failed * fixed test * fix import * refactor
1 parent b354db0 commit b3302f6

34 files changed

+1025
-707
lines changed

analysis_options.yaml

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,4 @@
1-
include: package:pedantic/analysis_options.1.9.0.yaml
2-
3-
analyzer:
4-
exclude:
5-
- "**/*.g.dart"
6-
- "lib/src/generated/*.dart"
7-
- "lib/generated/*.dart"
1+
include: package:pedantic/analysis_options.1.11.0.yaml
82
linter:
93
rules:
104
- prefer_final_locals

ios/Flutter/Debug.xcconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1+
#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"
12
#include "Generated.xcconfig"

ios/Flutter/Release.xcconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1+
#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"
12
#include "Generated.xcconfig"

ios/Podfile

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# Uncomment this line to define a global platform for your project
2+
# platform :ios, '9.0'
3+
4+
# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
5+
ENV['COCOAPODS_DISABLE_STATS'] = 'true'
6+
7+
project 'Runner', {
8+
'Debug' => :debug,
9+
'Profile' => :release,
10+
'Release' => :release,
11+
}
12+
13+
def flutter_root
14+
generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'Generated.xcconfig'), __FILE__)
15+
unless File.exist?(generated_xcode_build_settings_path)
16+
raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure flutter pub get is executed first"
17+
end
18+
19+
File.foreach(generated_xcode_build_settings_path) do |line|
20+
matches = line.match(/FLUTTER_ROOT\=(.*)/)
21+
return matches[1].strip if matches
22+
end
23+
raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Generated.xcconfig, then run flutter pub get"
24+
end
25+
26+
require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root)
27+
28+
flutter_ios_podfile_setup
29+
30+
target 'Runner' do
31+
use_frameworks!
32+
use_modular_headers!
33+
34+
flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))
35+
end
36+
37+
post_install do |installer|
38+
installer.pods_project.targets.each do |target|
39+
flutter_additional_ios_build_settings(target)
40+
end
41+
end

ios/Podfile.lock

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
PODS:
2+
- Flutter (1.0.0)
3+
- url_launcher (0.0.1):
4+
- Flutter
5+
6+
DEPENDENCIES:
7+
- Flutter (from `Flutter`)
8+
- url_launcher (from `.symlinks/plugins/url_launcher/ios`)
9+
10+
EXTERNAL SOURCES:
11+
Flutter:
12+
:path: Flutter
13+
url_launcher:
14+
:path: ".symlinks/plugins/url_launcher/ios"
15+
16+
SPEC CHECKSUMS:
17+
Flutter: 434fef37c0980e73bb6479ef766c45957d4b510c
18+
url_launcher: 6fef411d543ceb26efce54b05a0a40bfd74cbbef
19+
20+
PODFILE CHECKSUM: aafe91acc616949ddb318b77800a7f51bffa2a4c
21+
22+
COCOAPODS: 1.10.1

ios/Runner.xcodeproj/project.pbxproj

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
/* Begin PBXBuildFile section */
1010
1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; };
11+
1A21DCEE3DE78A1D21D26B00 /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = EB768B4204415C8FBCCC747D /* Pods_Runner.framework */; };
1112
3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; };
1213
74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74858FAE1ED2DC5600515810 /* AppDelegate.swift */; };
1314
97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; };
@@ -32,6 +33,8 @@
3233
1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = "<group>"; };
3334
1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = "<group>"; };
3435
3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = "<group>"; };
36+
3B3BD4CC6A8856DF08406DEB /* Pods-Runner.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.profile.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig"; sourceTree = "<group>"; };
37+
44B2AC065ECCAB378C2BC0F4 /* Pods-Runner.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"; sourceTree = "<group>"; };
3538
74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Runner-Bridging-Header.h"; sourceTree = "<group>"; };
3639
74858FAE1ED2DC5600515810 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
3740
7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = "<group>"; };
@@ -42,19 +45,33 @@
4245
97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
4346
97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; };
4447
97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
48+
A76075E96402D5105A58231E /* Pods-Runner.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.release.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"; sourceTree = "<group>"; };
49+
EB768B4204415C8FBCCC747D /* Pods_Runner.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Runner.framework; sourceTree = BUILT_PRODUCTS_DIR; };
4550
/* End PBXFileReference section */
4651

4752
/* Begin PBXFrameworksBuildPhase section */
4853
97C146EB1CF9000F007C117D /* Frameworks */ = {
4954
isa = PBXFrameworksBuildPhase;
5055
buildActionMask = 2147483647;
5156
files = (
57+
1A21DCEE3DE78A1D21D26B00 /* Pods_Runner.framework in Frameworks */,
5258
);
5359
runOnlyForDeploymentPostprocessing = 0;
5460
};
5561
/* End PBXFrameworksBuildPhase section */
5662

5763
/* Begin PBXGroup section */
64+
41B5D0620437BDE84174843D /* Pods */ = {
65+
isa = PBXGroup;
66+
children = (
67+
44B2AC065ECCAB378C2BC0F4 /* Pods-Runner.debug.xcconfig */,
68+
A76075E96402D5105A58231E /* Pods-Runner.release.xcconfig */,
69+
3B3BD4CC6A8856DF08406DEB /* Pods-Runner.profile.xcconfig */,
70+
);
71+
name = Pods;
72+
path = Pods;
73+
sourceTree = "<group>";
74+
};
5875
9740EEB11CF90186004384FC /* Flutter */ = {
5976
isa = PBXGroup;
6077
children = (
@@ -72,6 +89,8 @@
7289
9740EEB11CF90186004384FC /* Flutter */,
7390
97C146F01CF9000F007C117D /* Runner */,
7491
97C146EF1CF9000F007C117D /* Products */,
92+
41B5D0620437BDE84174843D /* Pods */,
93+
C2737BD6DE9255A8562ED7ED /* Frameworks */,
7594
);
7695
sourceTree = "<group>";
7796
};
@@ -98,19 +117,29 @@
98117
path = Runner;
99118
sourceTree = "<group>";
100119
};
120+
C2737BD6DE9255A8562ED7ED /* Frameworks */ = {
121+
isa = PBXGroup;
122+
children = (
123+
EB768B4204415C8FBCCC747D /* Pods_Runner.framework */,
124+
);
125+
name = Frameworks;
126+
sourceTree = "<group>";
127+
};
101128
/* End PBXGroup section */
102129

103130
/* Begin PBXNativeTarget section */
104131
97C146ED1CF9000F007C117D /* Runner */ = {
105132
isa = PBXNativeTarget;
106133
buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */;
107134
buildPhases = (
135+
4F6D4B147F5BA51318D0F7A8 /* [CP] Check Pods Manifest.lock */,
108136
9740EEB61CF901F6004384FC /* Run Script */,
109137
97C146EA1CF9000F007C117D /* Sources */,
110138
97C146EB1CF9000F007C117D /* Frameworks */,
111139
97C146EC1CF9000F007C117D /* Resources */,
112140
9705A1C41CF9048500538489 /* Embed Frameworks */,
113141
3B06AD1E1E4923F5004D2608 /* Thin Binary */,
142+
C7C0FC8E5501989235E07919 /* [CP] Embed Pods Frameworks */,
114143
);
115144
buildRules = (
116145
);
@@ -183,6 +212,28 @@
183212
shellPath = /bin/sh;
184213
shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" embed_and_thin";
185214
};
215+
4F6D4B147F5BA51318D0F7A8 /* [CP] Check Pods Manifest.lock */ = {
216+
isa = PBXShellScriptBuildPhase;
217+
buildActionMask = 2147483647;
218+
files = (
219+
);
220+
inputFileListPaths = (
221+
);
222+
inputPaths = (
223+
"${PODS_PODFILE_DIR_PATH}/Podfile.lock",
224+
"${PODS_ROOT}/Manifest.lock",
225+
);
226+
name = "[CP] Check Pods Manifest.lock";
227+
outputFileListPaths = (
228+
);
229+
outputPaths = (
230+
"$(DERIVED_FILE_DIR)/Pods-Runner-checkManifestLockResult.txt",
231+
);
232+
runOnlyForDeploymentPostprocessing = 0;
233+
shellPath = /bin/sh;
234+
shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
235+
showEnvVarsInLog = 0;
236+
};
186237
9740EEB61CF901F6004384FC /* Run Script */ = {
187238
isa = PBXShellScriptBuildPhase;
188239
buildActionMask = 2147483647;
@@ -197,6 +248,23 @@
197248
shellPath = /bin/sh;
198249
shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build";
199250
};
251+
C7C0FC8E5501989235E07919 /* [CP] Embed Pods Frameworks */ = {
252+
isa = PBXShellScriptBuildPhase;
253+
buildActionMask = 2147483647;
254+
files = (
255+
);
256+
inputFileListPaths = (
257+
"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-input-files.xcfilelist",
258+
);
259+
name = "[CP] Embed Pods Frameworks";
260+
outputFileListPaths = (
261+
"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-output-files.xcfilelist",
262+
);
263+
runOnlyForDeploymentPostprocessing = 0;
264+
shellPath = /bin/sh;
265+
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh\"\n";
266+
showEnvVarsInLog = 0;
267+
};
200268
/* End PBXShellScriptBuildPhase section */
201269

202270
/* Begin PBXSourcesBuildPhase section */

ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

ios/Runner.xcworkspace/contents.xcworkspacedata

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
import 'dart:ui';
22

3+
import 'package:built_collection/built_collection.dart';
4+
35
abstract class ColorRemoteSource {
4-
Future<Map<String, Color>> getColors();
6+
Future<BuiltMap<String, Color>> getColors();
57
}

lib/data/remote/color_remote_source_impl.dart

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import 'dart:convert';
22
import 'dart:io';
33
import 'dart:ui';
44

5+
import 'package:built_collection/built_collection.dart';
56
import 'package:http/http.dart' as http;
67
import 'package:meta/meta.dart';
78

@@ -11,14 +12,14 @@ class ColorRemoteSourceImpl implements ColorRemoteSource {
1112
final http.Client _client;
1213
final Uri _url;
1314

14-
Map<String, Color> _cachedColors;
15+
BuiltMap<String, Color>? _cachedColors;
1516

1617
ColorRemoteSourceImpl(this._client, this._url);
1718

1819
@override
19-
Future<Map<String, Color>> getColors() async {
20+
Future<BuiltMap<String, Color>> getColors() async {
2021
if (_cachedColors != null) {
21-
return _cachedColors;
22+
return _cachedColors!;
2223
}
2324

2425
final response = await _client.get(_url);
@@ -30,13 +31,17 @@ class ColorRemoteSourceImpl implements ColorRemoteSource {
3031
);
3132
}
3233

33-
return _cachedColors = (jsonDecode(response.body) as Map).map((key, value) {
34+
return _cachedColors =
35+
((jsonDecode(response.body) as Map).map((key, value) {
3436
final color = value['color'];
3537
return MapEntry(
36-
key,
37-
color != null ? colorFromHex(color) : color,
38+
key as String,
39+
color is String ? colorFromHex(color) : null,
3840
);
39-
});
41+
})
42+
..removeWhere((key, value) => value == null))
43+
.cast<String, Color>()
44+
.build();
4045
}
4146

4247
@visibleForTesting

0 commit comments

Comments
 (0)