improve dart implementation, fix js implementation in component.js