File tree Expand file tree Collapse file tree 3 files changed +16
-0
lines changed Expand file tree Collapse file tree 3 files changed +16
-0
lines changed Original file line number Diff line number Diff line change 4
4
through method channels. You can send the address of the pointer as ` long ` and
5
5
reconstruct the class using the helper method.
6
6
- Fixed a bug where it would be possible for a type class inference to fail.
7
+ - Return 'null' when calling ` toString ` on a null object.
7
8
8
9
## 0.12.0
9
10
Original file line number Diff line number Diff line change @@ -127,6 +127,9 @@ class JObject {
127
127
_class.instanceMethodId (r'toString' , r'()Ljava/lang/String;' );
128
128
@override
129
129
String toString () {
130
+ if (reference.isNull) {
131
+ return 'null' ;
132
+ }
130
133
return _toStringId (this , const JStringType (), [])
131
134
.toDartString (releaseOriginal: true );
132
135
}
Original file line number Diff line number Diff line change @@ -296,4 +296,16 @@ void run({required TestRunnerCallback testRunner}) {
296
296
throwsA (isA <AssertionError >()),
297
297
);
298
298
});
299
+
300
+ testRunner ('toString' , () {
301
+ final long = JLong (1 );
302
+ expect (
303
+ long.toString (),
304
+ '1' ,
305
+ );
306
+ expect (
307
+ JLong .fromReference (jNullReference).toString (),
308
+ 'null' ,
309
+ );
310
+ });
299
311
}
You can’t perform that action at this time.
0 commit comments