Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import 'package:flutter/material.dart';
- import 'package:audioplayers/audio_cache.dart';
- void main() => runApp(MyApp());
- class MyApp extends StatelessWidget {
- // This widget is the root of your application.
- @override
- Widget build(BuildContext context) {
- return MaterialApp(
- title: 'Flutter Demo',
- theme: ThemeData(
- primarySwatch: Colors.blue,
- ),
- home: MyHomePage(),
- );
- }
- }
- class MyHomePage extends StatefulWidget {
- @override
- _MyHomePageState createState() => _MyHomePageState();
- }
- class _MyHomePageState extends State<MyHomePage> {
- static AudioCache _audioCache = new AudioCache();
- @override
- void initState() {
- // TODO: implement initState
- super.initState();
- _audioCache.play('assets/jogando.mp3');
- }
- @override
- Widget build(BuildContext context) {
- return Scaffold(
- body: Center(
- child: Text("player")
- ),
- );
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement