Search code examples
androidiosfluttersyncfusion

Unable to execute Syncfusion gauge chart in flutter


Unable to execute Syncfusion gauge chart in flutter, I have imported the syncfusion based on the documentation in the pub.dev, after running i am getting an error , I have syncfusion in my pubspec.yaml file too

the error i got is '

FAILURE: Build failed with an exception.

  • Where: Script '/Users/apple/flutter/packages/flutter_tools/gradle/flutter.gradle' line: 1156
  • What went wrong: Execution failed for task ':app:compileFlutterBuildDebug'.

Process 'command '/Users/apple/flutter/bin/flutter'' finished with non-zero exit value 1

  • Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
  • Get more help at https://help.gradle.org

BUILD FAILED in 15s Exception: Gradle task assembleDebug failed with exit code 1 '

'''

import 'package:flutter/material.dart'; 
import 'package:syncfusion_flutter_gauges/gauges.dart'; 
void main(){
  runApp(new MaterialApp( 
  home:new myapp() ,
 ));
 }
 class myapp extends StatefulWidget {
  const myapp({Key? key}) : super(key: key);

 @override
  _myappState createState() => _myappState(); 
 }
  class _myappState extends State<myapp> {    
   @override
   Widget build(BuildContext context) {
    return new Scaffold(
      appBar: new AppBar(
   title: new Text("MyApp"),
   ),
    body:Container(
        child:Container(
          height: 500,
          width: 500,
            child: SfRadialGauge(
                axes: <RadialAxis>[
                  RadialAxis(minimum: 0, maximum: 150,
                      ranges: <GaugeRange>[
                        GaugeRange(startValue: 0, endValue: 50, color:Colors.green),
                        GaugeRange(startValue: 50,endValue: 100,color: Colors.orange),
                        GaugeRange(startValue: 100,endValue: 150,color: Colors.red)],
                      pointers: <GaugePointer>[
                        NeedlePointer(value: 90)],
                      annotations: <GaugeAnnotation>[
                        GaugeAnnotation(widget: Container(child:
                        Text('90.0',style: TextStyle(fontSize: 25,fontWeight: FontWeight.bold))),
                            angle: 90, positionFactor: 0.5
                        )]
                  )]),
        ),
    )
);
}
}

'''


Solution

  • I have checked the mentioned scenario and cannot reproduce the mentioned issue from my side. I suggest you run the flutter clean command and try once again. If you are still facing this issue, share a simple sample project to reproduce the issue which you are facing.