Skip to content

Commit

Permalink
Merge pull request #31 from JHBitencourt/null_safety
Browse files Browse the repository at this point in the history
Stable null safety
  • Loading branch information
JHBitencourt authored Mar 10, 2021
2 parents 6886b02 + 3eedcb2 commit b68f61b
Show file tree
Hide file tree
Showing 25 changed files with 195 additions and 238 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
## [2.0.0]

*** Breaking Changes ***

Stable null-safety support.

## [1.0.0]

*** Breaking Changes ***
Expand Down
76 changes: 15 additions & 61 deletions example/ios/Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,78 +10,32 @@ project 'Runner', {
'Release' => :release,
}

def parse_KV_file(file, separator='=')
file_abs_path = File.expand_path(file)
if !File.exists? file_abs_path
return [];
def flutter_root
generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'Generated.xcconfig'), __FILE__)
unless File.exist?(generated_xcode_build_settings_path)
raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure flutter pub get is executed first"
end
generated_key_values = {}
skip_line_start_symbols = ["#", "/"]
File.foreach(file_abs_path) do |line|
next if skip_line_start_symbols.any? { |symbol| line =~ /^\s*#{symbol}/ }
plugin = line.split(pattern=separator)
if plugin.length == 2
podname = plugin[0].strip()
path = plugin[1].strip()
podpath = File.expand_path("#{path}", file_abs_path)
generated_key_values[podname] = podpath
else
puts "Invalid plugin specification: #{line}"
end

File.foreach(generated_xcode_build_settings_path) do |line|
matches = line.match(/FLUTTER_ROOT\=(.*)/)
return matches[1].strip if matches
end
generated_key_values
raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Generated.xcconfig, then run flutter pub get"
end

require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root)

flutter_ios_podfile_setup

target 'Runner' do
use_frameworks!
use_modular_headers!

# Flutter Pod

copied_flutter_dir = File.join(__dir__, 'Flutter')
copied_framework_path = File.join(copied_flutter_dir, 'Flutter.framework')
copied_podspec_path = File.join(copied_flutter_dir, 'Flutter.podspec')
unless File.exist?(copied_framework_path) && File.exist?(copied_podspec_path)
# Copy Flutter.framework and Flutter.podspec to Flutter/ to have something to link against if the xcode backend script has not run yet.
# That script will copy the correct debug/profile/release version of the framework based on the currently selected Xcode configuration.
# CocoaPods will not embed the framework on pod install (before any build phases can generate) if the dylib does not exist.

generated_xcode_build_settings_path = File.join(copied_flutter_dir, 'Generated.xcconfig')
unless File.exist?(generated_xcode_build_settings_path)
raise "Generated.xcconfig must exist. If you're running pod install manually, make sure flutter pub get is executed first"
end
generated_xcode_build_settings = parse_KV_file(generated_xcode_build_settings_path)
cached_framework_dir = generated_xcode_build_settings['FLUTTER_FRAMEWORK_DIR'];

unless File.exist?(copied_framework_path)
FileUtils.cp_r(File.join(cached_framework_dir, 'Flutter.framework'), copied_flutter_dir)
end
unless File.exist?(copied_podspec_path)
FileUtils.cp(File.join(cached_framework_dir, 'Flutter.podspec'), copied_flutter_dir)
end
end

# Keep pod path relative so it can be checked into Podfile.lock.
pod 'Flutter', :path => 'Flutter'

# Plugin Pods

# Prepare symlinks folder. We use symlinks to avoid having Podfile.lock
# referring to absolute paths on developers' machines.
system('rm -rf .symlinks')
system('mkdir -p .symlinks/plugins')
plugin_pods = parse_KV_file('../.flutter-plugins')
plugin_pods.each do |name, path|
symlink = File.join('.symlinks', 'plugins', name)
File.symlink(path, symlink)
pod name, :path => File.join(symlink, 'ios')
end
flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))
end

post_install do |installer|
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings['ENABLE_BITCODE'] = 'NO'
end
flutter_additional_ios_build_settings(target)
end
end
18 changes: 3 additions & 15 deletions example/ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2,33 +2,21 @@ PODS:
- Flutter (1.0.0)
- path_provider (0.0.1):
- Flutter
- path_provider_linux (0.0.1):
- Flutter
- path_provider_macos (0.0.1):
- Flutter

DEPENDENCIES:
- Flutter (from `Flutter`)
- path_provider (from `.symlinks/plugins/path_provider/ios`)
- path_provider_linux (from `.symlinks/plugins/path_provider_linux/ios`)
- path_provider_macos (from `.symlinks/plugins/path_provider_macos/ios`)

EXTERNAL SOURCES:
Flutter:
:path: Flutter
path_provider:
:path: ".symlinks/plugins/path_provider/ios"
path_provider_linux:
:path: ".symlinks/plugins/path_provider_linux/ios"
path_provider_macos:
:path: ".symlinks/plugins/path_provider_macos/ios"

SPEC CHECKSUMS:
Flutter: 0e3d915762c693b495b44d77113d4970485de6ec
Flutter: 434fef37c0980e73bb6479ef766c45957d4b510c
path_provider: abfe2b5c733d04e238b0d8691db0cfd63a27a93c
path_provider_linux: 4d630dc393e1f20364f3e3b4a2ff41d9674a84e4
path_provider_macos: f760a3c5b04357c380e2fddb6f9db6f3015897e0

PODFILE CHECKSUM: c34e2287a9ccaa606aeceab922830efb9a6ff69a
PODFILE CHECKSUM: aafe91acc616949ddb318b77800a7f51bffa2a4c

COCOAPODS: 1.8.4
COCOAPODS: 1.10.0
11 changes: 4 additions & 7 deletions example/ios/Runner.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -247,15 +247,12 @@
buildActionMask = 2147483647;
files = (
);
inputPaths = (
"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh",
"${PODS_ROOT}/../Flutter/Flutter.framework",
"${BUILT_PRODUCTS_DIR}/path_provider/path_provider.framework",
inputFileListPaths = (
"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-input-files.xcfilelist",
);
name = "[CP] Embed Pods Frameworks";
outputPaths = (
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Flutter.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/path_provider.framework",
outputFileListPaths = (
"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-output-files.xcfilelist",
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions example/lib/src/example/example_1.dart
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ return Container(
);

class Example1Vertical extends StatelessWidget {
const Example1Vertical({Key key}) : super(key: key);
const Example1Vertical({Key? key}) : super(key: key);

@override
Widget build(BuildContext context) {
Expand All @@ -45,7 +45,7 @@ class Example1Vertical extends StatelessWidget {
}

class Example1Horizontal extends StatelessWidget {
const Example1Horizontal({Key key}) : super(key: key);
const Example1Horizontal({Key? key}) : super(key: key);

@override
Widget build(BuildContext context) {
Expand Down
4 changes: 2 additions & 2 deletions example/lib/src/example/example_10.dart
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ return Container(
);

class Example10Vertical extends StatelessWidget {
const Example10Vertical({Key key}) : super(key: key);
const Example10Vertical({Key? key}) : super(key: key);

@override
Widget build(BuildContext context) {
Expand Down Expand Up @@ -152,7 +152,7 @@ class Example10Vertical extends StatelessWidget {
}

class Example10Horizontal extends StatelessWidget {
const Example10Horizontal({Key key}) : super(key: key);
const Example10Horizontal({Key? key}) : super(key: key);

@override
Widget build(BuildContext context) {
Expand Down
4 changes: 2 additions & 2 deletions example/lib/src/example/example_2.dart
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ return Container(
);

class Example2Vertical extends StatelessWidget {
const Example2Vertical({Key key}) : super(key: key);
const Example2Vertical({Key? key}) : super(key: key);

@override
Widget build(BuildContext context) {
Expand Down Expand Up @@ -61,7 +61,7 @@ class Example2Vertical extends StatelessWidget {
}

class Example2Horizontal extends StatelessWidget {
const Example2Horizontal({Key key}) : super(key: key);
const Example2Horizontal({Key? key}) : super(key: key);

@override
Widget build(BuildContext context) {
Expand Down
4 changes: 2 additions & 2 deletions example/lib/src/example/example_3.dart
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ return Container(
);

class Example3Vertical extends StatelessWidget {
const Example3Vertical({Key key}) : super(key: key);
const Example3Vertical({Key? key}) : super(key: key);

@override
Widget build(BuildContext context) {
Expand Down Expand Up @@ -61,7 +61,7 @@ class Example3Vertical extends StatelessWidget {
}

class Example3Horizontal extends StatelessWidget {
const Example3Horizontal({Key key}) : super(key: key);
const Example3Horizontal({Key? key}) : super(key: key);

@override
Widget build(BuildContext context) {
Expand Down
4 changes: 2 additions & 2 deletions example/lib/src/example/example_4.dart
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ return Container(
);

class Example4Vertical extends StatelessWidget {
const Example4Vertical({Key key}) : super(key: key);
const Example4Vertical({Key? key}) : super(key: key);

@override
Widget build(BuildContext context) {
Expand All @@ -54,7 +54,7 @@ class Example4Vertical extends StatelessWidget {
}

class Example4Horizontal extends StatelessWidget {
const Example4Horizontal({Key key}) : super(key: key);
const Example4Horizontal({Key? key}) : super(key: key);

@override
Widget build(BuildContext context) {
Expand Down
4 changes: 2 additions & 2 deletions example/lib/src/example/example_5.dart
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ return Container(
);

class Example5Vertical extends StatelessWidget {
const Example5Vertical({Key key}) : super(key: key);
const Example5Vertical({Key? key}) : super(key: key);

@override
Widget build(BuildContext context) {
Expand Down Expand Up @@ -112,7 +112,7 @@ class Example5Vertical extends StatelessWidget {
}

class Example5Horizontal extends StatelessWidget {
const Example5Horizontal({Key key}) : super(key: key);
const Example5Horizontal({Key? key}) : super(key: key);

@override
Widget build(BuildContext context) {
Expand Down
4 changes: 2 additions & 2 deletions example/lib/src/example/example_6.dart
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ return Container(
);

class Example6Vertical extends StatelessWidget {
const Example6Vertical({Key key}) : super(key: key);
const Example6Vertical({Key? key}) : super(key: key);

@override
Widget build(BuildContext context) {
Expand Down Expand Up @@ -145,7 +145,7 @@ class Example6Vertical extends StatelessWidget {
}

class Example6Horizontal extends StatelessWidget {
const Example6Horizontal({Key key}) : super(key: key);
const Example6Horizontal({Key? key}) : super(key: key);

@override
Widget build(BuildContext context) {
Expand Down
4 changes: 2 additions & 2 deletions example/lib/src/example/example_7.dart
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ return Container(
);

class Example7Vertical extends StatelessWidget {
const Example7Vertical({Key key}) : super(key: key);
const Example7Vertical({Key? key}) : super(key: key);

@override
Widget build(BuildContext context) {
Expand Down Expand Up @@ -119,7 +119,7 @@ class Example7Vertical extends StatelessWidget {
}

class Example7Horizontal extends StatelessWidget {
const Example7Horizontal({Key key}) : super(key: key);
const Example7Horizontal({Key? key}) : super(key: key);

@override
Widget build(BuildContext context) {
Expand Down
8 changes: 4 additions & 4 deletions example/lib/src/example/example_8.dart
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ class _Child extends StatelessWidget {
);

class Example8Vertical extends StatelessWidget {
const Example8Vertical({Key key}) : super(key: key);
const Example8Vertical({Key? key}) : super(key: key);

@override
Widget build(BuildContext context) {
Expand Down Expand Up @@ -204,7 +204,7 @@ class Example8Vertical extends StatelessWidget {
}

class Example8Horizontal extends StatelessWidget {
const Example8Horizontal({Key key}) : super(key: key);
const Example8Horizontal({Key? key}) : super(key: key);

@override
Widget build(BuildContext context) {
Expand Down Expand Up @@ -289,8 +289,8 @@ class Example8Horizontal extends StatelessWidget {

class _Child extends StatelessWidget {
const _Child({
Key key,
this.text,
Key? key,
required this.text,
this.font = 'Shrikhand',
}) : super(key: key);

Expand Down
4 changes: 2 additions & 2 deletions example/lib/src/example/example_9.dart
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ return Container(
);

class Example9Vertical extends StatelessWidget {
const Example9Vertical({Key key}) : super(key: key);
const Example9Vertical({Key? key}) : super(key: key);

@override
Widget build(BuildContext context) {
Expand Down Expand Up @@ -145,7 +145,7 @@ class Example9Vertical extends StatelessWidget {
}

class Example9Horizontal extends StatelessWidget {
const Example9Horizontal({Key key}) : super(key: key);
const Example9Horizontal({Key? key}) : super(key: key);

@override
Widget build(BuildContext context) {
Expand Down
Loading

0 comments on commit b68f61b

Please sign in to comment.