This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:flutter/material.dart'; | |
import 'package:audioplayers/audio_cache.dart'; | |
void main() => runApp(XylophoneApp()); | |
class XylophoneApp extends StatelessWidget { | |
void playSound(int SoundNumber) { | |
final player = AudioCache(); // * Create a FINAL(means constant) variable to create an instance of class AudioCache() so that we can use it our program | |
player.play('note$SoundNumber.wav'); // ! *** NOTE: USE ONLY note1.wav & NOT assets/note1.wav *** | |
// * Audioplayers package assumes that its default path is assets/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//DART FUNCTION TYPES EXAMPLES | |
//FUNCTIONS WITHOUT ARGUMENTS WITHOUT RETURN | |
void abc() | |
{ | |
print('Hi'); | |
} | |
//FUNCTION WITH ARGUMENTS WITH RETURN |