Search code examples
dartpolymerpaper-elements

Displaying a paper-toast polymer element in dart


Does anyone know how to show a paper-toast polymer element from dart. The only examples I can find use

<paper-button raised onclick="document.querySelector('#toast1').show()">Discard Draft</paper-button>

I have tried using $['myToast'].show() in my dart code but it doesn't seem to work. I have also tried using the querySelector and calling show() but I get a warning that show is not a method. If there isn't a way to do this from dart is there a way to call the javascript that will show the toast from dart?


Solution

  • This did the trick for me...

    import 'dart:html';
    import 'package:paper_elements/paper_toast.dart';
    
    document.querySelector('#notification').show();
    

    Ignore the warning... its just that... a warning.

    I suggest you clone the example project and take a look: https://github.com/dart-lang/polymer-core-and-paper-examples