This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void main() async { | |
final then = DateTime.now(); | |
print(then); | |
final r = await compute(veryLongRunningCpuBoundFunction, 10); | |
final now = DateTime.now(); | |
print('${now.difference(then)} later, the result is $r'); | |
} | |
int veryLongRunningCpuBoundFunction(int param) { | |
for (var i = 0; i < param; i++) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void main() { | |
final then = DateTime.now(); | |
print(then); | |
final r = veryLongRunningCpuBoundFunction(9); | |
final now = DateTime.now(); | |
print('${now.difference(then)} later, the result is $r'); | |
} | |
int veryLongRunningCpuBoundFunction(int param) { | |
for (var i = 0; i < param; i++) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
release { | |
... | |
ndk{ | |
abiFilters "armeabi-v7a" | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/app/build.gradle b/app/build.gradle | |
index d1b7792..dd96f56 100644 | |
--- a/app/build.gradle | |
+++ b/app/build.gradle | |
@@ -47,3 +47,15 @@ dependencies { | |
androidTestImplementation 'androidx.test:runner:1.1.0-alpha4' | |
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.0-alpha4' | |
} | |
+ | |
+ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git step/05app/src/main/java/pro/truongsinh/flutter/android_flutter_host/FlutterEmbeddingActivity.kt step/06app/src/main/java/pro/truongsinh/flutter/android_flutter_host/FlutterEmbeddingActivity.kt | |
index f2a07a4..6819729 100644 | |
--- step/05app/src/main/java/pro/truongsinh/flutter/android_flutter_host/FlutterEmbeddingActivity.kt | |
+++ step/06app/src/main/java/pro/truongsinh/flutter/android_flutter_host/FlutterEmbeddingActivity.kt | |
@@ -18,12 +24,92 @@ class FlutterEmbeddingActivity : FlutterActivity(), FlutterFragment.FlutterEngin | |
private class IntentBuilder// Override the constructor to specify your class. | |
internal constructor() : FlutterActivity.IntentBuilder(FlutterEmbeddingActivity::class.java) | |
+ private fun createPluginRegistry(messenger: BinaryMessenger, activity: Activity): PluginRegistry { | |
+ return object : PluginRegistry { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git step/05lib/main.dart step/06lib/main.dart | |
index 3e2871f..d4af3e9 100644 | |
--- step/05lib/main.dart | |
+++ step/06lib/main.dart | |
@@ -2,6 +2,8 @@ import 'dart:async'; | |
import 'dart:ui'; | |
import 'package:flutter/material.dart'; | |
import 'package:flutter/services.dart'; | |
+import 'package:path_provider/path_provider.dart' | |
+ show getApplicationDocumentsDirectory; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git step/04app/src/main/java/pro/truongsinh/flutter/android_flutter_host/MainActivity.kt step/05app/src/main/java/pro/truongsinh/flutter/android_flutter_host/MainActivity.kt | |
index fbf9de8..c0e8651 100644 | |
--- step/04app/src/main/java/pro/truongsinh/flutter/android_flutter_host/MainActivity.kt | |
+++ step/05app/src/main/java/pro/truongsinh/flutter/android_flutter_host/MainActivity.kt | |
@@ -1,6 +1,8 @@ | |
package pro.truongsinh.flutter.android_flutter_host | |
+import android.content.Intent | |
import android.os.Bundle | |
+import android.util.Log |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git step/04app/src/main/java/pro/truongsinh/flutter/android_flutter_host/FlutterEmbeddingActivity.kt step/05app/src/main/java/pro/truongsinh/flutter/android_flutter_host/FlutterEmbeddingActivity.kt | |
index 862daf7..f2a07a4 100644 | |
--- step/04app/src/main/java/pro/truongsinh/flutter/android_flutter_host/FlutterEmbeddingActivity.kt | |
+++ step/05app/src/main/java/pro/truongsinh/flutter/android_flutter_host/FlutterEmbeddingActivity.kt | |
@@ -6,8 +6,10 @@ import io.flutter.embedding.engine.FlutterEngine | |
import io.flutter.embedding.android.FlutterActivity | |
import io.flutter.embedding.android.FlutterFragment | |
import android.os.Bundle | |
+import android.content.Intent | |
import androidx.core.content.ContextCompat.startActivity |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git step/04lib/main.dart step/05lib/main.dart | |
index 33b2ca3..3e2871f 100644 | |
--- step/04lib/main.dart | |
+++ step/05lib/main.dart | |
@@ -14,8 +14,11 @@ class MyApp extends StatefulWidget { | |
class _MyAppState extends State<MyApp> { | |
final EventChannel _eventChannel = | |
const EventChannel('pro.truongsinh.flutter.android_flutter_host/event'); | |
+ final MethodChannel _methodChannel = | |
+ const MethodChannel('pro.truongsinh.flutter.android_flutter_host/method'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git step/03app/src/main/java/pro/truongsinh/flutter/android_flutter_host/MainActivity.kt step/04app/src/main/java/pro/truongsinh/flutter/android_flutter_host/MainActivity.kt | |
index a3f4eea..fbf9de8 100644 | |
--- step/03app/src/main/java/pro/truongsinh/flutter/android_flutter_host/MainActivity.kt | |
+++ step/04app/src/main/java/pro/truongsinh/flutter/android_flutter_host/MainActivity.kt | |
@@ -6,6 +6,7 @@ import android.view.Menu | |
import android.view.MenuItem | |
import kotlinx.android.synthetic.main.activity_main.* | |
+import kotlinx.android.synthetic.main.content_main.* | |