-
Notifications
You must be signed in to change notification settings - Fork 29.7k
Closed
Description
Steps to Reproduce
Run the following app and click the "print app dir" button lots of times. observe that sometimes the result is null and other times we get the app dir.
import 'dart:async';
import 'dart:io';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
void main() {
runApp(
new MaterialApp(
title: 'Flutter Demo',
theme: new ThemeData(
primarySwatch: Colors.blue,
),
home: new FlutterDemo(),
),
);
}
class FlutterDemo extends StatefulWidget {
FlutterDemo({Key key}) : super(key: key);
@override
_FlutterDemoState createState() => new _FlutterDemoState();
}
class _FlutterDemoState extends State<FlutterDemo> {
Future printAppDir() async {
Directory appDir = await PathProvider.getApplicationDocumentsDirectory();
print(appDir?.path ?? "null appDir");
}
@override
Widget build(BuildContext context) {
return new Scaffold(
appBar: new AppBar(
title: new Text('Flutter Demo'),
),
body: new Column(children: [
new RaisedButton(
child: new Text("print app dir"), onPressed: printAppDir),
]));
}
}
Logs
Users/drewwarren/Library/Developer/CoreSimulator/Devices/16BCCC3C-2F9C-401F-B2BF-97F1E3D2929A/data/Containers/Data/Application/A3252D13-A6D7-4B9F-8563-A339446A1E43/Documents
/Users/drewwarren/Library/Developer/CoreSimulator/Devices/16BCCC3C-2F9C-401F-B2BF-97F1E3D2929A/data/Containers/Data/Application/A3252D13-A6D7-4B9F-8563-A339446A1E43/Documents
null appDir
/Users/drewwarren/Library/Developer/CoreSimulator/Devices/16BCCC3C-2F9C-401F-B2BF-97F1E3D2929A/data/Containers/Data/Application/A3252D13-A6D7-4B9F-8563-A339446A1E43/Documents
null appDir
null appDir
null appDir
null appDir
null appDir
/Users/drewwarren/Library/Developer/CoreSimulator/Devices/16BCCC3C-2F9C-401F-B2BF-97F1E3D2929A/data/Containers/Data/Application/A3252D13-A6D7-4B9F-8563-A339446A1E43/Documents
/Users/drewwarren/Library/Developer/CoreSimulator/Devices/16BCCC3C-2F9C-401F-B2BF-97F1E3D2929A/data/Containers/Data/Application/A3252D13-A6D7-4B9F-8563-A339446A1E43/Documents
null appDir
Flutter Doctor
[✓] Flutter (on Mac OS, channel master)
• Flutter at /Users/drewwarren/flutter
• Framework revision 3203757958 (52 minutes ago), 2016-10-17 10:30:13
• Engine revision d999f6c123
• Tools Dart version 1.20.1
[x] Android toolchain - develop for Android devices
x Android Studio / Android SDK not found. Download from https://developer.android.com/sdk/
(or visit https://flutter.io/setup/#android-setup for detailed instructions).
[✓] iOS toolchain - develop for iOS devices (Xcode 7.3.1)
• XCode at /Applications/Xcode.app/Contents/Developer
• Xcode 7.3.1, Build version 7D1014
[✓] Atom - a lightweight development environment for Flutter
• flutter plugin version 0.2.5
• dartlang plugin version 0.6.39
[-] IntelliJ IDEA Community Edition (version 2016.2)
• Dart plugin not installed; this adds Dart specific functionality.
• Flutter plugin not installed; this adds Flutter specific functionality.
• For information about managing plugins, see
https://www.jetbrains.com/help/idea/2016.2/managing-plugins.html
[✓] Connected devices
• iPhone 5s • 16BCCC3C-2F9C-401F-B2BF-97F1E3D2929A • ios (simulator)