Im trying to play a ringintone when the class is initialized and turn in off using a slider buttion.Player is created successfully upon initialization,but for some reason cannot turn it off using the slider button due to following error.
E/flutter ( 6529): [ERROR:flutter/lib/ui/ui_dart_state.cc(166)] Unhandled Exception: MissingPluginException(No implementation found for method hasVibrator on channel vibration) E/flutter ( 6529): #0 MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:154:7) E/flutter ( 6529): E/flutter ( 6529): #1 MethodChannel.invokeMethod (package:flutter/src/services/platform_channel.dart:329:12) E/flutter ( 6529): #2 Vibration.hasVibrator (package:slider_button/src/vibration.dart:20:43)
But I have not used the Vibrator in any way.Folloing is my code
import 'package:flutter/material.dart';
import 'package:slider_button/slider_button.dart';
import 'package:correcteddistancetrack/Interfaces/ringingtone.dart';
class snoozeScreen extends StatefulWidget {
@override
_snoozeScreenState createState() => _snoozeScreenState();
}
class _snoozeScreenState extends State<snoozeScreen> {
@override
void initState(){
RingPhone().ringnow();
}
@override
Widget build(BuildContext context) {
return Scaffold(
body: Container(
width: double.infinity,
height: double.infinity,
decoration: BoxDecoration(
//color: Colors.red,
gradient: LinearGradient(
begin: Alignment.centerLeft,
end: Alignment.centerRight,
colors: [Colors.blueAccent,Colors.greenAccent]
),
),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
SliderButton(
label: Text("Slide to stop alarm",style: TextStyle(fontSize: 25),),
icon: Icon(Icons.alarm,size: 40,),
action: (){
RingPhone().stopNow();
//Navigator.pop(context);
},
width: 320,
),
],
),
),
);
}
}
Really grateful if anyone can assist