Huawei Map Kit integration. Error: Inconvertible types; cannot cast 'android.support.v4.app.Fragment' to 'com.huawei.hms.maps.SupportMapFragment' - huawei-mobile-services

Error: Inconvertible types; cannot cast 'android.support.v4.app.Fragment' to 'com.huawei.hms.maps.SupportMapFragment'
Using android appcompat dependecy in their project. like below,
implementation 'com.android.support:appcompat-v7:28.0.0'

SupportMapFragment is extending androidx.fragmnet.app.Fragment
If you are not using AndroidX please go for MapFragment which is extending android.support.v4.app.Fragment
import com.huawei.hms.maps.MapFragment;
import android.support.v4.app.Fragment;
MapFragment mapFragment= (MapFragment) getActivity().getFragmentManager().findFragmentById(R.id.mapFragment);

Related

Why my flutter-quill error and cannot running even though i change the version?

flutter_quill-5.4.2/lib/src/widgets/raw_editor.dart:233:7: Error: Thenon-abstract class 'RawEditorState' is missing implementations for these members:
TextInputClient.didChangeInputControl
TextInputClient.performSelector
Try to either
provide an implementation,
inherit an implementation from a superclass or mixin,
mark the class as abstract, or
provide a 'noSuchMethod' implementation.
class RawEditorState extends EditorState
^^^^^^^^^^^^^^
/C:/src/flutter/packages/flutter/lib/src/services/text_input.dart:1163:8:
Context: 'TextInputClient.didChangeInputControl'is defined here.
void didChangeInputControl(TextInputControl? oldControl, TextInputControl? newControl{}
^^^^^^^^^^^^^^^^^^^^^
/C:/src/flutter/packages/flutter/lib/src/services/text_input.dart:1184:8:
Context: 'TextInputClient.performSelector' isdefined here.
void performSelector(String selectorName){}
^^^^^^^^^^^^^^^
i already did flutter upgrade and update or change flutter quill version, but the problem still same.
Do not forget to add "hide Text" after the import of flutter quill:
import 'package:flutter_quill/flutter_quill.dart' hide Text;
I have also ran into this issue and the way I solved it was by reinstalling flutter.

The method 'initializeApp' isn't defined for the type 'FirebaseApp'

why doesn't initializeApp() work? do i need another package? I get this error : The method 'initializeApp' isn't defined for the type 'FirebaseApp'
import 'package:firebase_core/firebase_core.dart';
void main(){
Firebase.initializeApp();
FirebaseApp.initializeApp();
...
There's nothing in the documentation that says you should call a method initializeApp on FirebaseApp. The method really doesn't exist as the error message says.
You just get a FirebaseApp object back from Firebase.initializeApp().
See:
https://firebase.flutter.dev/docs/core/usage/
https://firebase.flutter.dev/docs/overview/
I think if you are using one of the latest firebase packages you need to use the new Firebase CLI way of configuring. Check this out https://firebase.flutter.dev/docs/cli/. Overall it's the installation process of FlutterFire across all supported platforms.
You can also follow through this answer https://stackoverflow.com/a/73774075/10698100
FirebaseApp.initializeApp() can't be used in the main.dart, it's for MainActivity and you need these packages
In MainActivity
import com.google.firebase.FirebaseApp;
import com.google.firebase.appcheck.FirebaseAppCheck;
import com.google.firebase.appcheck.playintegrity.PlayIntegrityAppCheckProviderFactory;
In pubspec.yaml
firebase_app_check: ^0.1.1+8

Can Dart conditional imports use names?

Consider a conditional import statement. The following comes from the Dart language guide:
import 'src/hw_none.dart'
if (dart.library.io) 'src/hw_io.dart'
if (dart.library.html) 'src/hw_html.dart';
Is there a syntax to add a name to these imports? For example, I'd like to say something like the following:
import 'src/hw_none.dart' as my_prefix
if (dart.library.io) 'src/hw_io.dart' as my_prefix
if (dart.library.html) 'src/hw_html.dart' as my_prefix;
Unfortunately, the above doesn't compile. I haven't been able to find a variation that does compile.
Is there a way to name conditionally imported packages?
I've done something like this a few month ago, to implement mobile and web functionalities. Seems like you cannot name each import separately.
import 'package:flutter_fcm_web_example/notification_helper.dart';
import 'firebase_mobile_messaging.dart'
if (dart.library.html) 'firebase_web_messaging.dart' as notifInstance;
abstract class NotificationEncapsulation {
static NotificationHelper get instance =>
notifInstance.FirebaseMessagingHelper();
}

Play 2.5.X dependency injection

I am upgrading play framework app from 2.4.6 to 2.5.x.
There are several occurrences where I call helper methods which belongs to some object. These helper methods use play's built-in classes(for example play.api.Play.current.configuration.underlying.getString) to get the job done.
I get following warning: "method current in object Play is deprecated: This is a static reference to application, use DI instead"
If I face this problem in class method then I can use dependency injection. How to deal with such a situation where method belongs to object and I am warned to use DI?
Play Framework usually provides a class you can inject instead of using the old static references.
For example, the below would mean you can stop using Play.current.configuration and DB:
import javax.inject.Inject
import play.api.db.Database
import play.api.Configuration
class MyClass #Inject() (configuration: Configuration, db: Database) {
...
}

Unable to import ChannelSftp.LsEntry from Jsch when I use it in Scala code, why?

So in my scala class, I had to use the Jsch(JAVA) library to do SFTP work. But for some reason, it is unable to import:
import com.jcraft.jsch.ChannelSftp.LsEntry
Any idea why this would be? LsEntry is a nested class of ChannelSftp.
http://epaul.github.io/jsch-documentation/simple.javadoc/com/jcraft/jsch/ChannelSftp.html
package services.impl
import java.nio.file.Path
import com.jcraft.jsch.ChannelSftp
import com.jcraft.jsch.ChannelSftp.LsEntry
import services.InputService
class InputServiceImpl extends InputService[List[ChannelSftp.LsEntry]] {
}
Figured it out.
In scala, to reference an nested class, you use the following syntax:
ChannelSftp#LsEntry