Skip to content

Commit e2d198b

Browse files
Merge pull request #5 from andre-paraense/null-safety
Null safety migration
2 parents 06eeb89 + 5483708 commit e2d198b

File tree

17 files changed

+198
-235
lines changed

17 files changed

+198
-235
lines changed

.idea/workspace.xml

Lines changed: 19 additions & 54 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 2.0.0
2+
3+
* Null-safety migration
4+
15
## 1.0.1
26

37
* Bumping Survicate Android and iOS SDKs

android/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
group 'com.oakam.survicate.survicate_flutter_sdk'
2-
version '1.0.1'
2+
version '2.0.0'
33

44
buildscript {
55
ext.kotlin_version = '1.3.50'
@@ -41,5 +41,5 @@ android {
4141

4242
dependencies {
4343
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
44-
implementation 'com.survicate:survicate-sdk:1.2.3'
44+
implementation 'com.survicate:survicate-sdk:1.2.4'
4545
}

android/src/main/kotlin/com/oakam/survicate/survicate_flutter_sdk/SurvicateFlutterSdkPlugin.kt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ class SurvicateFlutterSdkPlugin: FlutterPlugin, ActivityAware, MethodCallHandler
6565
try {
6666
channel.invokeMethod("onSurveyDisplayed", arguments)
6767
} catch (e: Exception) {
68-
Log.e("onSurveyDisplayed", e.message)
68+
e.message?.let { Log.e("onSurveyDisplayed", it) }
6969
}
7070
})
7171
}
@@ -84,7 +84,7 @@ class SurvicateFlutterSdkPlugin: FlutterPlugin, ActivityAware, MethodCallHandler
8484
try {
8585
channel.invokeMethod("onQuestionAnswered", arguments)
8686
} catch (e: Exception) {
87-
Log.e("onQuestionAnswered", e.message)
87+
e.message?.let { Log.e("onQuestionAnswered", it) }
8888
}
8989
})
9090
}
@@ -96,7 +96,7 @@ class SurvicateFlutterSdkPlugin: FlutterPlugin, ActivityAware, MethodCallHandler
9696
try {
9797
channel.invokeMethod("onSurveyClosed", arguments)
9898
} catch (e: Exception) {
99-
Log.e("onSurveyClosed", e.message)
99+
e.message?.let { Log.e("onSurveyClosed", it) }
100100
}
101101
})
102102
}
@@ -108,7 +108,7 @@ class SurvicateFlutterSdkPlugin: FlutterPlugin, ActivityAware, MethodCallHandler
108108
try {
109109
channel.invokeMethod("onSurveyCompleted", arguments)
110110
} catch (e: Exception) {
111-
Log.e("onSurveyCompleted", e.message)
111+
e.message?.let { Log.e("onSurveyCompleted", it) }
112112
}
113113
})
114114
}

example/android/app/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ apply plugin: 'kotlin-android'
2626
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
2727

2828
android {
29-
compileSdkVersion 29
29+
compileSdkVersion 30
3030

3131
sourceSets {
3232
main.java.srcDirs += 'src/main/kotlin'
@@ -40,7 +40,7 @@ android {
4040
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
4141
applicationId "com.oakam.survicate.survicate_flutter_sdk_example"
4242
minSdkVersion 16
43-
targetSdkVersion 29
43+
targetSdkVersion 30
4444
versionCode flutterVersionCode.toInteger()
4545
versionName flutterVersionName
4646
}

example/android/build.gradle

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

88
dependencies {
9-
classpath 'com.android.tools.build:gradle:4.1.0'
9+
classpath 'com.android.tools.build:gradle:4.1.3'
1010
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
1111
}
1212
}

example/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.

example/lib/main.dart

Lines changed: 14 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -13,19 +13,13 @@ class MyApp extends StatefulWidget {
1313
}
1414

1515
class _MyAppState extends State<MyApp> {
16-
SurvicateFlutterSdk survicateFlutterSdk;
17-
String surveyIdDisplayed;
18-
String surveyIdAnswered;
19-
num questionIdAnswered;
20-
SurvicateAnswerModel answer;
21-
String surveyIdClosed;
22-
String surveyIdCompleted;
23-
24-
@override
25-
void initState() {
26-
super.initState();
27-
survicateFlutterSdk ??= SurvicateFlutterSdk();
28-
}
16+
SurvicateFlutterSdk survicateFlutterSdk= SurvicateFlutterSdk();
17+
String? surveyIdDisplayed;
18+
String? surveyIdAnswered;
19+
num? questionIdAnswered;
20+
SurvicateAnswerModel? answer;
21+
String? surveyIdClosed;
22+
String? surveyIdCompleted;
2923

3024
@override
3125
Widget build(BuildContext context) {
@@ -41,7 +35,7 @@ class _MyAppState extends State<MyApp> {
4135
mainAxisAlignment: MainAxisAlignment.center,
4236
crossAxisAlignment: CrossAxisAlignment.stretch,
4337
children: [
44-
RaisedButton(
38+
ElevatedButton(
4539
onPressed: () {
4640
survicateFlutterSdk.invokeEvent('SURVEY');
4741
},
@@ -50,13 +44,13 @@ class _MyAppState extends State<MyApp> {
5044
SizedBox(
5145
height: 5.0,
5246
),
53-
RaisedButton(
47+
ElevatedButton(
5448
onPressed: () {
5549
survicateFlutterSdk.enterScreen('SCREEN');
5650
},
5751
child: Text('Enter screen SCREEN'),
5852
),
59-
RaisedButton(
53+
ElevatedButton(
6054
onPressed: () {
6155
survicateFlutterSdk.leaveScreen('SCREEN');
6256
},
@@ -65,7 +59,7 @@ class _MyAppState extends State<MyApp> {
6559
SizedBox(
6660
height: 5.0,
6761
),
68-
RaisedButton(
62+
ElevatedButton(
6963
onPressed: () {
7064
survicateFlutterSdk.setUserTraits(
7165
UserTraitsModel(userId: '1', firstName: 'USER'));
@@ -75,7 +69,7 @@ class _MyAppState extends State<MyApp> {
7569
SizedBox(
7670
height: 5.0,
7771
),
78-
RaisedButton(
72+
ElevatedButton(
7973
onPressed: () {
8074
setState(() {
8175
surveyIdDisplayed = null;
@@ -92,7 +86,7 @@ class _MyAppState extends State<MyApp> {
9286
SizedBox(
9387
height: 5.0,
9488
),
95-
RaisedButton(
89+
ElevatedButton(
9690
onPressed: () {
9791
setState(() {
9892
surveyIdDisplayed = null;
@@ -129,7 +123,7 @@ class _MyAppState extends State<MyApp> {
129123
SizedBox(
130124
height: 5.0,
131125
),
132-
RaisedButton(
126+
ElevatedButton(
133127
onPressed: () {
134128
setState(() {
135129
surveyIdDisplayed = null;

0 commit comments

Comments
 (0)