DataTransfer extension type
The DataTransfer
object is used to hold the data that is being dragged
during a drag and drop operation. It may hold one or more data items, each
of one or more data types. For more information about drag and drop, see
HTML Drag and Drop API.
This object is available from the DragEvent.dataTransfer property of all DragEvent.
Constructors
- DataTransfer()
-
factory
Properties
- dropEffect ↔ String
-
getter/setter pair
- effectAllowed ↔ String
-
getter/setter pair
- files → FileList
-
no setter
- hashCode → int
-
The hash code for this object.
no setterinherited
- items → DataTransferItemList
-
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
types
→ JSArray<
JSString> -
no setter
Methods
-
clearData(
[String format]) → void -
The
DataTransfer.clearData()
method removes the drag operation's DataTransfer for the given type. If data for the given type does not exist, this method does nothing. -
getData(
String format) → String -
The
DataTransfer.getData()
method retrieves drag data (as a string) for the specified type. If the drag operation does not include data, this method returns an empty string. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
setData(
String format, String data) → void -
The
DataTransfer.setData()
method sets the drag operation's DataTransfer to the specified data and type. If data for the given type does not exist, it is added at the end of the drag data store, such that the last item in the DataTransfer.types list will be the new type. If data for the given type already exists, the existing data is replaced in the same position. That is, the order of the DataTransfer.types list is not changed when replacing data of the same type. -
setDragImage(
Element image, int x, int y) → void -
When a drag occurs, a translucent image is generated from the drag target
(the element
the
HTMLElement/dragstart_event
event is fired at), and follows the mouse pointer during the drag. This image is created automatically, so you do not need to create it yourself. However, if a custom image is desired, theDataTransfer.setDragImage()
method can be used to set the custom image to be used. The image will typically be animg
element but it can also be acanvas
or any other visible element. -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited