Home > OS >  How to add TradingView charts to Flutter app?
How to add TradingView charts to Flutter app?

Time:12-09

I am currently working on an app that displays crypto currency details. So, I somehow need to display candlestick charts of coins against USDT. I already tried a major of libraries provided by flutter community but none of them was suitable for me. So I though that the best way to do this is displaying trading view charts in my personal app. However, ı couldn't figure out how to do it.

I found a library that displays web content: Emulator Screen Shot

It seems like something happens, but not in the supposed way. Anyway to fix this ?

CodePudding user response:

The website provides the embedded code that you can load to your webview.

// Get the embedded code from website
String embeddedCode = '...';

WebView(
    initialUrl: '',
    javascriptMode: JavascriptMode.unrestricted,
    onWebViewCreated: (WebViewController controller) async {
        controller.loadUrl(Uri.dataFromString(
            embeddedCode,
            mimeType: 'text/html',
            encoding: Encoding.getByName('utf-8')).toString());
    },
)
  • Related