4

I made an app which should produce a click sound when a button is clicked.

I've tried the code bellow and it didn't work.

import 'package:flutter/services.dart';
...
SystemSound.play(SystemSoundType.click);

I expect the app produce sound when a button is clicked, but it didn't. I work on an Android app.

paijo
  • 83
  • 1
  • 1
  • 7

1 Answers1

0

Add a sound in res/raw folder of your project and then RingtoneManager.getRingtone( getApplicationContext(), Uri.parse("android.resource://" + YOUR_PACKAGE_NAME + "/" + R.raw.soundFileInRawfolder) ).play();

look here , here or here

S.R
  • 2,819
  • 2
  • 22
  • 49