2017-09-17 13 views

답변

3

당신은 그것을 변화를 듣고 temporary 또는 persistent

import "dart:html"; 
import "dart:async"; 

StreamSubscription<Event> subscription = window.onResize.listen((Event e) { 
    final width = window.screen.width; 
}); 

// onDestroy 
subscription.cancel(); 
+0

오류로 레이아웃을 설정하는 창에서 onResize 이벤트를 사용할 수 있습니다 : '구독'의 유형이 있기 때문에 사용의 추론 될 수 없다 인스턴스 getter 'onResize'. –

+0

// onDestroy subscription.cancel(); 'subscription'잘못된 생성자 이름 –

+0

코드를 업데이트했습니다. –