admin管理员组

文章数量:1122846

I'm trying to make a very simple app in Flutter (for my Android phone, Xiaomi 13T). It's supposed to run in the background and immediately set an alarm if I get a particular type of email from my Gmail. I figured the first thing that I should do is set up the persistence and a basic UI. Here's the code to add the file:

void add_to_file(String email, String search_term, String sender) async {
  final filename = './alert_file.txt';
  new File(filename).create(recursive: true);
  final f =  File(filename).writeAsString('$email,$search_term,$sender\n',mode: FileMode.append);  
  print('added file');

}

I connected the app to my phone, flutter build apk, flutter install, and ran in debug mode from VS Code and got the following:

I/ImeTracker(26100): com.example.email_alarm:1215632d: onCancelled at PHASE_CLIENT_APPLY_ANIMATION
I/flutter (26100): added file

Based on this, my function is running, but I can't find the created file anywhere. I also can't find the com.example.email_alarm folder in my phone's app data. The program works as intended when I run it as a desktop app. When I run it in my laptop's chrome, it just hangs when I press the button to trigger the add_to_file function.

Is the app writing to a file? If so, where is it?

本文标签: androidWhere can I find the file my flutter app createdStack Overflow