Skip to content

Instantly share code, notes, and snippets.

@truongsinh
Created April 17, 2019 02:07
Show Gist options
  • Save truongsinh/5a9d91635c94cd7619cb088d331350c0 to your computer and use it in GitHub Desktop.
Save truongsinh/5a9d91635c94cd7619cb088d331350c0 to your computer and use it in GitHub Desktop.
step 06 dart
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;
void main() => runApp(MyApp());
@@ -61,9 +63,10 @@ class _MyAppState extends State<MyApp> {
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Text('This is another Flutter route with args $_routeArgs'),
- RaisedButton(onPressed: () {
+ RaisedButton(onPressed: () async {
_methodChannel.invokeMethod('navigatorPop', <String, dynamic>{
- "returnArg1": "val2",
+ "returnArg1":
+ (await getApplicationDocumentsDirectory()).path,
"returnArg2": 2,
});
})
diff --git step/05pubspec.yaml step/06pubspec.yaml
index 5b033ce..6ced2ee 100644
--- step/05pubspec.yaml
+++ step/06pubspec.yaml
@@ -21,6 +21,7 @@ environment:
sdk: ">=2.1.0 <3.0.0"
dependencies:
+ path_provider: 0.5.0+1
flutter:
sdk: flutter
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment