title: How to display a part of the webpage using WebViewController plugin in Flutter?
body: <p>I have a <strong>div id</strong> as campaign-nav and <strong>class id</strong> as campaign-term-list and also </p>
  
  <p>I don’t want to show a header, menu, and footer. In Android, I can do with below code: (WebViewController android code found: <a href="https://stackoverflow.com/questions/12257929/display-a-part-of-the-webpage-on-the-webview-android">Display a part of the webpage on the webview android</a>)</p>
  
  <p><strong>How can I display a part of the webpage using WebViewController plugin in Flutter?</strong></p>
  
  <pre><code>view.getSettings().setJavaScriptEnabled(true);
          view.setWebViewClient(new WebViewClient() {
  
              @Override
              public void onPageFinished(WebView view, String URL)
              {
                  view.loadUrl("javascript:(function() { " +
                          "var head = document.getElementsByClassName('header')[0].style.display='none'; " +
                          "var head = document.getElementsByClassName('blog-sidebar')[0].style.display='none'; " +
                          "var head = document.getElementsByClassName('footer-container')[0].style.display='none'; " +
                          "})()");
  
              }
          });
          view.loadUrl("your url");
  </code></pre>
  
  <p><strong>UPDATE:</strong>
  Flutter example has;</p>
  
  <pre><code> final Completer&lt;WebViewController&gt; _controller = Completer&lt;WebViewController&gt;();
  </code></pre>
  
  <p>And they use _controller as;</p>
  
  <pre><code>new WebView(
                initialUrl:
                    'h****s://mysite.com/campaing/',
                javascriptMode: JavascriptMode.unrestricted,
                onWebViewCreated: (WebViewController webViewController) {
                  _controller.complete(webViewController);
                },
                javascriptChannels: &lt;JavascriptChannel&gt;[
                  _toasterJavascriptChannel(context),
                ].toSet(),
  
                onPageFinished: (String url) {
                  print('Page finished loading: $url');
  
                  //Here is I put a boolean variable so I can show a progress indicator
                  setState(() {
                    _loadedPage = true;
  
                  });
                },
              ),
  </code></pre>
  
  <p><strong>Update-2:</strong>
  In my web page I have footer as shown below.</p>
  
  <pre><code>&lt;div id="footer"&gt;
      &lt;div class="container"&gt;
          &lt;div class="row"&gt;
              &lt;div class="col-md-4"&gt;
                  &lt;div class="footer-menu"&gt;
  </code></pre>
  
  <p>I put your code inside below _controller.complete(webViewController); part. But still shows the footer. </p>
  
  <pre><code>onWebViewCreated: (WebViewController webViewController) {
                  _controller.complete(webViewController);
                  webViewController.evaluateJavascript("document.getElementsByClassName('footer-menu')[0].style.display='none';");
                },
  </code></pre>
  
  <p>When I try to put webViewController.evaluateJavascript inside onPageFinished part it doesn't find the ".evaluateJavascript" part.</p>
  
  <p><strong>Update-3:</strong>
  <strong>Full code:(not working)</strong></p>
  
  <pre><code>new WebView(
                initialUrl: 'https://stackoverflow.com',
                javascriptMode: JavascriptMode.unrestricted,
                onWebViewCreated: (controller){
                  _myController = controller;
                },
                javascriptChannels: &lt;JavascriptChannel&gt;[
                  _toasterJavascriptChannel(context),
                ].toSet(),
                onPageFinished: (url){
                  print('Page finished loading: $url');
                  _myController.evaluateJavascript("document.getElementsByClassName('header')[0].style.display='none';");
                  setState(() {
                    _loadedPage = true;
                  });
                },
              ),
  </code></pre>