<File IO>
dependencies:
path_provider: ^2.0.8
import 'package:path_provider/path_provider.dart';
import 'dart:io';
_write(String text) async {
final Directory directory = await getApplicationDocumentsDirectory();
final File file = File('${directory.path}/my_file.txt');
await file.writeAsString(text);
}
Future<String> _read() async {
String text;
try {
final Directory directory = await getApplicationDocumentsDirectory();
final File file = File('${directory.path}/my_file.txt');
text = await file.readAsString();
} catch (e) {
print("Couldn't read file");
}
return text;
}
<Delay>
Future.delayed(Duration(milliseconds: 1500), () {
print('Hello');
});
<가로모드 허용하지 않음, only portrait>
SystemChrome.setPreferredOrientations(
[DeviceOrientation.portraitUp, DeviceOrientation.portraitDown])
.then((_) => runApp(MyApp(),
));
'Flutter' 카테고리의 다른 글
Flutter - carousel_slider (0) | 2022.02.06 |
---|---|
Flutter - 주요 단축기/배너제거/플랫폼구분 (0) | 2022.02.06 |
Flutter - ToJson (0) | 2022.02.06 |
Flutter - Database (0) | 2022.02.06 |
Flutter App Bar/화면크기조절/화면전환 (0) | 2022.02.06 |