Skip to content

Commit 6f648fc

Browse files
committed
升级gradle,禁止flutter_stetho
1 parent 130121e commit 6f648fc

File tree

10 files changed

+130
-33
lines changed

10 files changed

+130
-33
lines changed

example/.vscode/launch.json

Lines changed: 22 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,23 @@
11
{
2-
3-
"version": "0.2.0",
4-
"configurations": [
5-
{
6-
"name": "Flutter Desktop Attach",
7-
"request": "attach",
8-
"observatoryUri": "http://127.0.0.1:52878/UWW_6_X9Y74=/",
9-
"type": "dart"
10-
}
11-
]
12-
}
2+
"version": "0.2.0",
3+
"configurations": [
4+
{
5+
"name": "Flutter",
6+
"type": "dart",
7+
"request": "launch",
8+
"program": "lib/main.dart"
9+
},
10+
{
11+
"name": "Dart",
12+
"type": "dart",
13+
"request": "launch",
14+
"program": "bin/main.dart"
15+
},
16+
{
17+
"name": "Flutter Desktop Attach",
18+
"request": "attach",
19+
"observatoryUri": "http://127.0.0.1:52878/UWW_6_X9Y74=/",
20+
"type": "dart"
21+
}
22+
]
23+
}

example/android/app/build.gradle

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ apply plugin: 'com.android.application'
1515
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
1616

1717
android {
18-
compileSdkVersion 27
18+
compileSdkVersion 28
1919

2020
lintOptions {
2121
disable 'InvalidPackage'
@@ -25,7 +25,7 @@ android {
2525
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
2626
applicationId "com.example.flutterpluginexample"
2727
minSdkVersion 16
28-
targetSdkVersion 27
28+
targetSdkVersion 28
2929
versionCode 1
3030
versionName "1.0"
3131
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
@@ -46,6 +46,6 @@ flutter {
4646

4747
dependencies {
4848
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'
49+
androidTestImplementation 'com.android.support.test:runner:1.0.2'
50+
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
5151
}

example/android/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ buildscript {
55
}
66

77
dependencies {
8-
classpath 'com.android.tools.build:gradle:3.0.1'
8+
classpath 'com.android.tools.build:gradle:3.4.0'
99
}
1010
}
1111

example/android/gradle.properties

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
11
org.gradle.jvmargs=-Xmx1536M
2+
android.useAndroidX=true
3+
android.enableJetifier=true

example/android/gradle/wrapper/gradle-wrapper.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
33
distributionPath=wrapper/dists
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists
6-
distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip
6+
distributionUrl=https\://services.gradle.org/distributions/gradle-5.1.1-all.zip
Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
const String keyApplicationName = '';
2-
const String keyParseApplicationId = '';
3-
const String keyParseMasterKey = '';
4-
const String keyParseServerUrl = '';
1+
const String keyApplicationName = 'MyApp';
2+
const String keyParseApplicationId = 'myAppId';
3+
const String keyParseMasterKey = '123456';
4+
const String keyParseServerUrl = 'http://118.24.162.252:2018/parse';
5+
const String keyParseLiveServerUrl = 'ws://118.24.162.252:2018/parse';

example/lib/main.dart

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@ import 'package:flutter_plugin_example/data/repositories/diet_plan/repository_di
1010
import 'package:flutter_plugin_example/data/repositories/user/repository_user.dart';
1111
import 'package:flutter_plugin_example/domain/constants/application_constants.dart';
1212
import 'package:flutter_plugin_example/domain/utils/db_utils.dart';
13-
import 'package:flutter_stetho/flutter_stetho.dart';
13+
// import 'package:flutter_stetho/flutter_stetho.dart';
1414
import 'package:parse_server_sdk/parse_server_sdk.dart';
1515

1616
void main() {
17-
Stetho.initialize();
17+
// Stetho.initialize();
1818
_setTargetPlatformForDesktop();
1919

2020
runApp(MyApp());
@@ -119,7 +119,7 @@ class _MyAppState extends State<MyApp> {
119119
}
120120

121121
Future<void> test() async {
122-
User user = User('test_user', 'test_password', '[email protected]');
122+
User user = User('unreal', 'hhhhhh', '[email protected]');
123123
final ParseResponse signUpResponse = await user.signUp();
124124

125125
if (signUpResponse.success) {

example/macos/Podfile

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
platform :osx, '10.13'
2+
3+
# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
4+
ENV['COCOAPODS_DISABLE_STATS'] = 'true'
5+
6+
project 'Runner', {
7+
'Debug' => :debug,
8+
# TODO: Add Profile support to projects.
9+
#'Profile' => :release,
10+
'Release' => :release,
11+
}
12+
13+
def parse_KV_file(file, separator='=')
14+
file_abs_path = File.expand_path(file)
15+
if !File.exists? file_abs_path
16+
return [];
17+
end
18+
pods_ary = []
19+
skip_line_start_symbols = ["#", "/"]
20+
File.foreach(file_abs_path) { |line|
21+
next if skip_line_start_symbols.any? { |symbol| line =~ /^\s*#{symbol}/ }
22+
plugin = line.split(pattern=separator)
23+
if plugin.length == 2
24+
podname = plugin[0].strip()
25+
path = plugin[1].strip()
26+
podpath = File.expand_path("#{path}", file_abs_path)
27+
pods_ary.push({:name => podname, :path => podpath});
28+
else
29+
puts "Invalid plugin specification: #{line}"
30+
end
31+
}
32+
return pods_ary
33+
end
34+
35+
def pubspec_supports_macos(file)
36+
file_abs_path = File.expand_path(file)
37+
if !File.exists? file_abs_path
38+
return false;
39+
end
40+
File.foreach(file_abs_path) { |line|
41+
# TODO(stuartmorgan): Use formal platform declaration once it exists,
42+
# see https://github.com/flutter/flutter/issues/33597.
43+
return true if line =~ /^\s*macosPrefix:/
44+
}
45+
return false
46+
end
47+
48+
target 'Runner' do
49+
use_frameworks!
50+
51+
# Prepare symlinks folder. We use symlinks to avoid having Podfile.lock
52+
# referring to absolute paths on developers' machines.
53+
ephemeral_dir = File.join('Flutter', 'ephemeral')
54+
symlink_dir = File.join(ephemeral_dir, '.symlinks')
55+
symlink_plugins_dir = File.join(symlink_dir, 'plugins')
56+
system("rm -rf #{symlink_dir}")
57+
system("mkdir -p #{symlink_plugins_dir}")
58+
59+
# Flutter Pods
60+
generated_xcconfig = parse_KV_file(File.join(ephemeral_dir, 'Flutter-Generated.xcconfig'))
61+
if generated_xcconfig.empty?
62+
puts "Flutter-Generated.xcconfig must exist. If you're running pod install manually, make sure flutter packages get is executed first."
63+
end
64+
generated_xcconfig.map { |p|
65+
if p[:name] == 'FLUTTER_FRAMEWORK_DIR'
66+
symlink = File.join(symlink_dir, 'flutter')
67+
File.symlink(File.dirname(p[:path]), symlink)
68+
pod 'FlutterMacOS', :path => File.join(symlink, File.basename(p[:path]))
69+
end
70+
}
71+
72+
# Plugin Pods
73+
plugin_pods = parse_KV_file('../.flutter-plugins')
74+
plugin_pods.map { |p|
75+
symlink = File.join(symlink_plugins_dir, p[:name])
76+
File.symlink(p[:path], symlink)
77+
if pubspec_supports_macos(File.join(symlink, 'pubspec.yaml'))
78+
pod p[:name], :path => File.join(symlink, 'macos')
79+
end
80+
}
81+
end

example/pubspec.yaml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ dependencies:
88
# The following adds the Cupertino Icons font to your application.
99
# Use with the CupertinoIcons class for iOS style icons.
1010
cupertino_icons: ^0.1.2
11-
flutter_stetho: ^0.2.2
11+
# flutter_stetho: ^0.2.2
1212
sembast: ^1.13.3+1
1313
shared_preferences: ^0.5.0
1414

@@ -24,15 +24,14 @@ dev_dependencies:
2424

2525
# The following section is specific to Flutter.
2626
flutter:
27-
2827
# The following line ensures that the Material Icons font is
2928
# included with your application, so that you can use the icons in
3029
# the material Icons class.
3130
uses-material-design: true
3231

3332
# To add assets to your application, add an assets section, like this:
3433
assets:
35-
# - images/a_dot_burr.jpeg
34+
# - images/a_dot_burr.jpeg
3635
- assets/parse.png
3736

3837
# An image asset can refer to one or more resolution-specific "variants", see

lib/src/objects/response/parse_response_builder.dart

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -74,10 +74,13 @@ class _ParseResponseBuilder {
7474
for (int i = 0; i < object.length; i++) {
7575
final Map<String, dynamic> objectResult = list[i];
7676
if (objectResult.containsKey('success')) {
77-
final T item = _handleSingleResult<T>(object[i], objectResult['success'], false);
77+
final T item = _handleSingleResult<T>(
78+
object[i], objectResult['success'], false);
7879
response.results.add(item);
7980
} else {
80-
final ParseError error = ParseError(code: objectResult[keyCode], message: objectResult[keyError].toString());
81+
final ParseError error = ParseError(
82+
code: objectResult[keyCode],
83+
message: objectResult[keyError].toString());
8184
response.results.add(error);
8285
}
8386
}
@@ -121,10 +124,10 @@ class _ParseResponseBuilder {
121124
/// Handles a response with a single result object
122125
T _handleSingleResult<T>(
123126
T object, Map<String, dynamic> map, bool createNewObject) {
124-
if (createNewObject && object is ParseCloneable) {
125-
return object.clone(map);
126-
} else if (object is ParseObject) {
127+
if (object is ParseObject) {
127128
return object..fromJson(map);
129+
} else if (createNewObject && object is ParseCloneable) {
130+
return object.clone(map);
128131
} else {
129132
return null;
130133
}
@@ -133,4 +136,4 @@ class _ParseResponseBuilder {
133136
bool isHealthCheck(Response apiResponse) {
134137
return apiResponse.body == '{\"status\":\"ok\"}';
135138
}
136-
}
139+
}

0 commit comments

Comments
 (0)