Dart/Flutter Developer
Dart/Flutter developer for mobile application development for Android and iOS.
To take part in the internship, you need to fill out the form by following the link https://forms.gle/wsXqMm7LcTJzLSJJA
The last section of the form is reserved for answers to tasks, which are described below on this page. Most often, the answer field should contain a link to a gist with the text of your answer, or a link to a repository. Pay attention to what needs to be included in the form as your result. If instead of the required link you provide something else, like the text of the answer, your response is likely not to be counted.
Responsibilities
- Develop mobile applications using Dart and Flutter for Android and iOS.
Requirements
- Basic knowledge of Dart and Flutter. Sufficient for use in your pet projects.
- Willingness to learn multiple development technologies simultaneously in your personal time.
- Knowledge of any of the following is welcomed: SQL, HTML, CSS (also lesscss, sass), Linux CLI, Docker, git, VS Code (or other IDEs/editors).
- Basic literacy in Computer Science is welcome, including databases, network technologies, technological stacks for building web applications, operating systems architecture (primarily the Linux family).
Task 1. Develop a function to determine the game score
Problem
The code example below generates a list of game score states throughout a match.
Develop the function getScore(gameStamps, offset)
, which will return the score at the moment of the given offset
in the gameStamps
list.
You need to understand the essence of the written code, notice the nuances, and develop a function that fits the style of the existing code, with preferably adequate algorithmic complexity.
// lib/game.dart
import 'dart:math';
const TIMESTAMPS_COUNT = 50000;
const PROBABILITY_SCORE_CHANGED = 0.0001;
const PROBABILITY_HOME_SCORE = 0.45;
const OFFSET_MAX_STEP = 3;
class Score {
final int home;
final int away;
Score({
required this.home,
required this.away
});
}
class Stamp {
final int offset;
final Score score;
Stamp({
required this.offset,
required this.score
});
}
final Stamp emptyScoreStamp = Stamp(
offset: 0,
score: Score(
home: 0,
away: 0,
),
);
List<Stamp> generateGame() {
final stamps = List<Stamp>
.generate(TIMESTAMPS_COUNT, (score) => emptyScoreStamp);
var currentStamp = stamps[0];
for (var i = 0; i < TIMESTAMPS_COUNT; i++) {
currentStamp = generateStamp(currentStamp);
stamps[i] = currentStamp;
}
return stamps;
}
Stamp generateStamp(Stamp prev) {
final scoreChanged = Random().nextDouble() > 1 - PROBABILITY_SCORE_CHANGED;
final homeScoreChange =
scoreChanged && Random().nextDouble() < PROBABILITY_HOME_SCORE
? 1
: 0;
final awayScoreChange = scoreChanged && !(homeScoreChange > 0) ? 1 : 0;
final offsetChange = (Random().nextDouble() * OFFSET_MAX_STEP).floor() + 1;
return Stamp(
offset: prev.offset + offsetChange,
score: Score(
home: prev.score.home + homeScoreChange,
away: prev.score.away + awayScoreChange
),
);
}
Score getScore(List<Stamp> gameStamps, int offset) {
// continue the function's implementation
}
// bin/main.dart
import 'package:scope_game/game.dart';
void main() {
final game = generateGame();
game.forEach((e) {
print("offset - ${e.offset}; away - ${e.score.away}; home - ${e.score.home};");
});
}
Result
- A link to a gist with the source code of the function.
Task 2. Develop tests for the score determination function
Problem
For the function getScore(gameStamps, offset)
developed in the previous task, develop unit tests using the test library.
Tests should cover all possible use cases, focus on testing one case at a time, avoid repetition, and the test names should reflect the essence of the check being performed.
Result
- A link to a gist with the source code of the tests.
Task 3. Develop a mobile app for capturing a photo from the camera
Problem
The mobile app consists of a single screen with the following UI elements:
- A preview of the camera image
- A text input field for the user’s comment
- A button that sends a request to the server when pressed.
When the button is pressed, the app should determine the coordinates of the location where the camera is, capture the image from the camera, retrieve the comment from the text field, and send this as a request to the server. Example request:
curl -H "Content-Type: application/javascript" -X POST https://flutter-sandbox.free.beeceptor.com/upload_photo/ -F comment="A photo from the phone camera." -F latitude=38.897675 -F longitude=-77.036547 -F photo=@test.png
Implementation notes
The app must be built using Flutter. You can use any tools or libraries to fulfill the requirements. The UI design is up to you, and the ability to adapt to different devices will be evaluated.
Result
- A link to an apk file where the described functionality can be tested.
- Links to git repositories with the source code of the solution.