The code below used to work before null safety, but now I get "type 'Null' is not a subtype of type 'Future<String?>'" and I have absolutely no idea why and what to do. Please help, this should be really easy (except for me), because you just have to copy the code and run it as test to get the exception:
import 'package:flutter/services.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:mockito/mockito.dart';
class MockMethodChannel extends Mock implements MethodChannel {}
void main() {
group('all', () {
test('test', () async {
final mockMethodChannel = MockMethodChannel();
when(mockMethodChannel
.invokeMethod<String>("GET com.eight/preference-management/preferences"))
.thenAnswer((_) async => "test");
});
});
}