Flutter Developer
MobilePosted todayvia Himalayas, a remote job board
- Work type
- RemoteOpen worldwide
- Experience
- 3+ years
- Pay
- Not listed
- Posted
- Today
Skills it mentions
Add your skills to see which ones you have.
About the job
We are looking for a talented and experienced Flutter Developer to join our innovative team and contribute to the development and enhancement of our cutting-edge healthcare messaging app.
Requirements:
- 3+ years of experience with Flutter.
- Proficiency in BLoC.
- Experience with SQLite.
- Familiarity with Kotlin and/or Swift is an advantage.
- Experience developing applications for multiple platforms: iOS, Android, Windows, and MacOS.
- Strong understanding of mobile application architecture and design.
- Ability to write clean, maintainable, and efficient code.
- Excellent problem-solving skills and attention to detail.
- Strong communication skills and the ability to work collaboratively in a team environment.
- English proficiency at a B2 level or higher.
What We Offer:
- Remote job with the freedom to work from anywhere in the world.
- Flexible work schedule tailored to your life and work needs.
- Competitive and timely salary.
- Opportunities for professional growth and development.
- The chance to gain experience in various fields and participate in exciting projects.
- Your ideas and initiatives are always welcome and valued.
Originally posted on Himalayas
Interested?Flutter Developer at Hivex
Apply on Himalayas (opens in a new tab)The job ad ends here
Interview questions for this job6 with answers, on Flutter, Kotlin, Swift and 2 more
Interview questions for this job
For the skills the ad mentions: Flutter, Kotlin, Swift, iOS and Android.
What are
Slivers?FlutterA sliver is a portion of a scrollable area that you can define to behave in a special way. You can use slivers to achieve custom scrolling effects, such as elastic scrolling.
Under the hood, slivers are used to implement all of the scrollable views you use, including ListView and GridView. Slivers can be compared to a lower-level interface that offers more precise control over the implementation of scrollable areas.
Sliver lets you render child widgets lazily or render only the visible segment of the screen. Additionally, Sliver provides a better experience when you need to scroll a list of items and a grid of items all together as a single unit or create a collapsible header. It makes the overall scrolling effect of large lists effective and efficient.
Back to top ↑ / 🖌️ Edit answer
From Flutter Interview Questions (MIT)
How does the reified keyword in Kotlin work?Kotlin
TL;DR: What is
reifiedgood forfun <T> myGenericFun(c: Class<T>)Inside the body of a generic function such as
myGenericFun, it's impossible to access the typeTas it's only available at compile time but erased at runtime. Therefore, if you want to use the generic type as a normal class in the function body you need to explicitly pass the class as a parameter, as done formyGenericFunabove.On the other hand, when you create an
inlinefunction with a reifiedT, the type ofTcan be accessed even at runtime. With that, we don't need to pass theClass<T>additionally. We can work withTas if it was a normal class. For example, if we want to check if a variable is an instance ofT, we can:myVar is T.An
inlinefunction withreifiedtypeTas described looks as follows:inline fun <reified T> myGenericFun()How
reifiedworksWe can only use
reifiedcombined with aninlinefunction. By doing this, we instruct the compiler to copy the function's bytecode into every spot the function is invoked from (the compiler "inlines" the function). When we call aninlinefunction withreifiedtype, the compiler needs to know the actual type passed as a type argument so that it's able to modify the generated bytecode to use the corresponding class directly. Therefore a call likemyVar is TbecomesmyVar is Stringin the bytecode (assuming the type argument isString).Example
Let's look at an example demonstrating the benefits of
reified.We want to create an extension function for
Stringthat we calltoKotlinObject. It tries to convert a JSON string to a plain Kotlin object with a type specified by the function's generic typeT. We usecom.fasterxml.jackson.module.kotlinfor the conversion and the first approach is the following:a) First approach without reified type
fun <T> String.toKotlinObject(): T { val mapper = jacksonObjectMapper() //does not compile! return mapper.readValue(this, T::class.java) }The
readValuemethod takes a type to which it is supposed to parse theJsonObject. If we try to get the class (::class.java) of type parameterT, the compiler complains:Cannot use 'T' as reified type parameter. Use a class instead.
b) Workaround with explicit
Classparameterfun <T: Any> String.toKotlinObject(c: KClass<T>): T { val mapper = jacksonObjectMapper() return mapper.readValue(this, c.java) }As a workaround,
ClassofTcan be made a method parameter that we pass toreadValue. This approach works and is a common pattern in generic Java code. It can be invoked as follows:data class MyJsonType(val name: String) val json = """{"name":"example"}""" json.toKotlinObject(MyJsonType::class)c) The Kotlin way:
reifiedUsing an
inlinefunction withreifiedtype parameterT, we can implement the function more smoothly:inline fun <reified T: Any> String.toKotlinObject(): T { val mapper = jacksonObjectMapper() return mapper.readValue(this, T::class.java) }There’s no need to take the
ClassofTas an additional argument here sinceTcan be used as an ordinary class. For the client, the code looks like this:json.toKotlinObject<MyJsonType>()Important Note: Working with Java
Read the rest at the sourceFrom Stack Overflow: asked by hl3mukkel, answered by s1m0nw1 (CC BY-SA 4.0)
Why Choose Struct Over Class?Swift
According to the very popular WWDC 2015 talk Protocol Oriented Programming in Swift (video, transcript), Swift provides a number of features that make structs better than classes in many circumstances.
Structs are preferable if they are relatively small and copiable because copying is way safer than having multiple references to the same instance as happens with classes. This is especially important when passing around a variable to many classes and/or in a multithreaded environment. If you can always send a copy of your variable to other places, you never have to worry about that other place changing the value of your variable underneath you.
With Structs, there is much less need to worry about memory leaks or multiple threads racing to access/modify a single instance of a variable. (For the more technically minded, the exception to that is when capturing a struct inside a closure because then it is actually capturing a reference to the instance unless you explicitly mark it to be copied).
Classes can also become bloated because a class can only inherit from a single superclass. That encourages us to create huge superclasses that encompass many different abilities that are only loosely related. Using protocols, especially with protocol extensions where you can provide implementations to protocols, allows you to eliminate the need for classes to achieve this sort of behavior.
The talk lays out these scenarios where classes are preferred:
- Copying or comparing instances doesn't make sense (e.g.,
Window) - Instance lifetime is tied to external effects (e.g.,
TemporaryFile) - Instances are just "sinks"--write-only conduits to external state (e.g.,
CGContext)
It implies that structs should be the default and classes should be a fallback.
On the other hand, The Swift Programming Language documentation is somewhat contradictory:
Structure instances are always passed by value, and class instances are always passed by reference. This means that they are suited to different kinds of tasks. As you consider the data constructs and functionality that you need for a project, decide whether each data construct should be defined as a class or as a structure.
As a general guideline, consider creating a structure when one or more of these conditions apply:
- The structure’s primary purpose is to encapsulate a few relatively simple data values.
- It is reasonable to expect that the encapsulated values will be copied rather than referenced when you assign or pass around an instance of that structure.
- Any properties stored by the structure are themselves value types, which would also be expected to be copied rather than referenced.
- The structure does not need to inherit properties or behavior from another existing type.
Examples of good candidates for structures include:
- The size of a geometric shape, perhaps encapsulating a width property and a height property, both of type Double.
- A way to refer to ranges within a series, perhaps encapsulating a start property and a length property, both of type Int.
- A point in a 3D coordinate system, perhaps encapsulating x, y and z properties, each of type Double.
In all other cases, define a class, and create instances of that class to be managed and passed by reference. In practice, this means that most custom data constructs should be classes, not structures.
Read the rest at the sourceFrom Stack Overflow: asked by bluedevil2k, answered by drewag (CC BY-SA 4.0)
- Copying or comparing instances doesn't make sense (e.g.,
Consider the following code:iOS
Task:
var defaults = UserDefaults.standard() var userPref = defaults.stringForKey("userPref")! printString(userPref) func printString(string: String) { print(string) }Solution: The second line uses the stringForKey method of UserDefaults, which returns an optional, to account for the key not being found, or for the corresponding value not being convertible to a string.
During its execution, if the key is found and the corresponding value is a string, the above code works correctly. But if the key doesn’t exist, or the corresponding value is not a string, the app crashes with the following error:
fatal error: unexpectedly found nil while unwrapping an Optional value The reason is that the forced unwrapping operator ! is attempting to force unwrap a value from a nil optional. The forced unwrapping operator should be used only when an optional is known to contain a non-nil value.
The solution consists of making sure that the optional is not nil before force-unwrapping it:
let userPref = defaults.stringForKey("userPref") if userPref != nil { printString(userPref!) }From Awesome iOS Interview (MIT)
What do you know about PendingIntent?Android
PendingIntent
A
PendingIntentspecifies an action to take in the future. It lets you pass a futureIntentto another application and allow that application to execute thatIntentas if it had the same permissions as your application, whether or not your application is still around when theIntentis eventually invoked.By giving a
PendingIntentto another application, you are granting it the right to perform the operation you have specified as if the other application was yourself (with the same permissions and identity). As such, you should be careful about how you build thePendingIntent: often, for example, the baseIntentyou supply will have the component name explicitly set to one of your own components, to ensure it is ultimately sent there and nowhere else.It is an
Intentaction that you want to perform but at a later time. The reason it’s needed is because anIntentmust be created and launched from a valid context in your application, but there are certain cases where one is not available at the time you want to run the action because you are technically outside the application’s context.Android 12 includes important changes to pending intents, including a change that requires explicitly deciding when a
PendingIntentis mutable or immutable.Example of usage
The most common, and most basic, way to use a
PendingIntentis as the action associated with a notification:val intent = Intent(applicationContext, MainActivity::class.java).apply { action = NOTIFICATION_ACTION data = deepLink } val pendingIntent = PendingIntent.getActivity( applicationContext, NOTIFICATION_REQUEST_CODE, intent, PendingIntent.FLAG_IMMUTABLE ) val notification = NotificationCompat.Builder( applicationContext, NOTIFICATION_CHANNEL ).apply { // ... setContentIntent(pendingIntent) // ... }.build() notificationManager.notify( NOTIFICATION_TAG, NOTIFICATION_ID, notification )We can see that we’re constructing a standard type of
Intentthat will open our app, and then simply wrapping that in aPendingIntentbefore adding it to our notification.In this case, since we have an exact action we know we want to perform, we construct a
PendingIntentthat cannot be modified by the app we pass it to by utilizing a flag calledFLAG_IMMUTABLE.Updating an immutable PendingIntent
If an app needs to update a
PendingIntentthat it needs to be mutable, but that’s not always the case! The app that creates aPendingIntentcan always update it by passing the flagFLAG_UPDATE_CURRENT:val updatedIntent = Intent(applicationContext, MainActivity::class.java).apply { action = NOTIFICATION_ACTION data = differentDeepLink } // Because we're passing `FLAG_UPDATE_CURRENT`, this updates // the existing PendingIntent with the changes we made above. val updatedPendingIntent = PendingIntent.getActivity( applicationContext, NOTIFICATION_REQUEST_CODE, updatedIntent, PendingIntent.FLAG_IMMUTABLE or PendingIntent.FLAG_UPDATE_CURRENT ) // The PendingIntent has been updated.Details on flags
Read the rest at the sourceFrom Android Interview Questions (Apache 2.0)
Do you have any weaknesses?Behavioural
You should be honest when answering questions on your weaknesses. Say how you're working to improve them.
ExampleQuestion - "Do you have any weaknesses?"
Answer - "I struggle with time management on projects. To make sure I stick to the time frame I'm creating a timetable of steps at the start of each project".
From National Careers Service: interview advice (Open Government Licence v3.0)
