Click here to Skip to main content
14,575,277 members

Welcome to the Lounge

   

For discussing anything related to a software developer's life but is not for programming questions. Got a programming question?

The Lounge is rated Safe For Work. If you're about to post something inappropriate for a shared office environment, then don't post it. No ads, no abuse, and no programming questions. Trolling, (political, climate, religious or whatever) will result in your account being removed.
 
GeneralRe: Been over 20 minutes Pin
Eddy Vluggen5-Feb-20 6:37
professionalEddy Vluggen5-Feb-20 6:37 
GeneralI need a project. Meh Pin
honey the codewitch31-Jan-20 11:40
mvahoney the codewitch31-Jan-20 11:40 
GeneralRe: I need a project. Meh Pin
Mark_Wallace31-Jan-20 18:56
MemberMark_Wallace31-Jan-20 18:56 
GeneralRe: I need a project. Meh Pin
TheGreatAndPowerfulOz3-Feb-20 4:50
MemberTheGreatAndPowerfulOz3-Feb-20 4:50 
GeneralRe: I need a project. Meh Pin
BillWoodruff1-Feb-20 1:40
mveBillWoodruff1-Feb-20 1:40 
GeneralRe: I need a project. Meh Pin
honey the codewitch1-Feb-20 3:31
mvahoney the codewitch1-Feb-20 3:31 
GeneralRe: I need a project. Meh Pin
Peter Shaw5-Feb-20 1:45
professionalPeter Shaw5-Feb-20 1:45 
GeneralOne commit ago, Dart code worked just fine Pin
Afzaal Ahmad Zeeshan31-Jan-20 8:56
mvaAfzaal Ahmad Zeeshan31-Jan-20 8:56 
Ever happened to you that everything worked just fine for you, you take a back up, make changes and it refuses to work as it is intended to?

I am currently working on a Flutter app, which worked just perfectly! I committed the recent changes,
$ git log -1
commit 6441c90ee1c010362eb81740184fb50d900b46a1 (HEAD -> master, gitlab/master)
Author: Afzaal Ahmad Zeeshan <my-email@example.com>
Date:   Thu Jan 30 02:49:38 2020 +0500

    Contacts and lists now showing the phone numbers are showing too.
The "past me" is telling me that database integration worked and SQLite receives all the records from the device for app usage. That is where I paused the development last night and committed the changes. Today I just resumed the development, and voila. The most basic of the code happens to not work.
var contacts = await ContactsService.getContacts();

if(contacts.length == 0) {
  print("[INFO] Device does not have any contacts.");
  return;
}

print("[INFO] Loaded ${contacts.length} contacts, attempting to save...");
var database = await $FloorAppDatabase.databaseBuilder(MyApp.dbName).build();

List<Recipient> newContacts = [];

contacts.forEach((contact) async {
  // This variable is a placeholder to support debugging the response from database.
  var _contact = await database.recipientDao.findRecipientById(contact.identifier);
  if(_contact == null) {
    // Save the contact.
    newContacts.add(Recipient(contact.identifier, contact.displayName));
  }
});

if(newContacts.length > 0) {
  await database.recipientDao.insertAllRecipients(newContacts);
  print("[INFO] Added ${newContacts.length} contacts.");
}
The code attempts to save the contacts from a device to a device-only database. The _contact is always null, newContacts always gets a new element for contact (since there is no record in the database). But as soon as it hits the if(newContacts.length > 0) { line, the length of the array drops to zero.

There isn't any closure (Dart is JavaScript of Google) in action, awaits are applied just fine to pause the execution at IO-bound tasks, but still, it simply refuses to work.

Interesting thing is that this is the same code I committed last night! Laugh | :laugh:
The sh*t I complain about
It's like there ain't a cloud in the sky and it's raining out - Eminem
~! Firewall !~

GeneralRe: One commit ago, Dart code worked just fine Pin
RickZeeland31-Jan-20 9:20
mveRickZeeland31-Jan-20 9:20 
GeneralRe: One commit ago, Dart code worked just fine Pin
raddevus31-Jan-20 10:06
mvaraddevus31-Jan-20 10:06 
GeneralRe: One commit ago, Dart code worked just fine Pin
Afzaal Ahmad Zeeshan31-Jan-20 12:23
mvaAfzaal Ahmad Zeeshan31-Jan-20 12:23 
GeneralRe: One commit ago, Dart code worked just fine Pin
Mark_Wallace31-Jan-20 10:12
MemberMark_Wallace31-Jan-20 10:12 
GeneralRe: One commit ago, Dart code worked just fine Pin
Jon McKee31-Jan-20 11:11
professionalJon McKee31-Jan-20 11:11 
GeneralRe: One commit ago, Dart code worked just fine Pin
Afzaal Ahmad Zeeshan31-Jan-20 12:20
mvaAfzaal Ahmad Zeeshan31-Jan-20 12:20 
GeneralRe: One commit ago, Dart code worked just fine Pin
Jon McKee31-Jan-20 13:08
professionalJon McKee31-Jan-20 13:08 
GeneralRe: One commit ago, Dart code worked just fine Pin
honey the codewitch31-Jan-20 11:29
mvahoney the codewitch31-Jan-20 11:29 
GeneralRe: One commit ago, Dart code worked just fine Pin
Afzaal Ahmad Zeeshan31-Jan-20 12:27
mvaAfzaal Ahmad Zeeshan31-Jan-20 12:27 
GeneralRe: One commit ago, Dart code worked just fine Pin
Eddy Vluggen31-Jan-20 11:42
professionalEddy Vluggen31-Jan-20 11:42 
GeneralRe: One commit ago, Dart code worked just fine Pin
Afzaal Ahmad Zeeshan31-Jan-20 12:30
mvaAfzaal Ahmad Zeeshan31-Jan-20 12:30 
GeneralRe: One commit ago, Dart code worked just fine Pin
Eddy Vluggen31-Jan-20 12:55
professionalEddy Vluggen31-Jan-20 12:55 
GeneralCloning disks - UEFI hell Pin
charlieg31-Jan-20 8:26
Membercharlieg31-Jan-20 8:26 
GeneralRe: Cloning disks - UEFI hell Pin
Cp-Coder31-Jan-20 8:53
MemberCp-Coder31-Jan-20 8:53 
GeneralRe: Cloning disks - UEFI hell Pin
charlieg31-Jan-20 9:16
Membercharlieg31-Jan-20 9:16 
GeneralRe: Cloning disks - UEFI hell Pin
Cp-Coder31-Jan-20 9:25
MemberCp-Coder31-Jan-20 9:25 
GeneralRe: Cloning disks - UEFI hell Pin
charlieg31-Jan-20 10:16
Membercharlieg31-Jan-20 10:16 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.