J Jia Hui Beginner First-hand experience
From my experience, yes you can keep a dog in an HDB flat but only approved smaller breeds, and you're allowed one dog per flat under HDB rules. There's an approved list of breeds suitable for flats, mostly small dogs, and you must license your dog with the authorities and renew it. The Project ADORE scheme also lets HDB households adopt certain local mixed-breed dogs that were previously not allowed. Practically, flat living means daily walks are essential because the space is small, and you must manage barking so neighbours don't complain. Toilet training on pee pads or scheduled walks is a must. Budget for vet bills, grooming and food. It's very doable and rewarding, but it's a 10 to 15 year commitment, so be sure before you get one.
M Marcus Beginner First-hand experience
I've raised a small dog in my HDB flat for years and it's great, but go in prepared. Check the current approved breed list before you fall in love with a particular dog, because keeping a non-approved breed in a flat can get you into trouble. License it properly, it's cheap and it's the law. My biggest tip is to address barking early with training, because noise complaints from neighbours are the number one issue in flats. Also think about who cares for the dog when you travel, since boarding costs add up. Consider adopting through Project ADORE or a shelter rather than buying, plenty of lovely dogs need homes. Puppy-proof your flat and be ready for the early mess. Once settled it's the best decision, just don't underestimate the daily commitment and cost.